5 years, 4 months ago.

How to set gpio drive strength on nRF51822

Hi,

I've started developing using the latest nRF51822 DK, and the mbed IDE, but can't figure out how to set the drive strength of gpio. The chip has a few configuration options for this, but the mbed api doesn't seem to have a method for setting low/high drive.

What's the best way to do this? Is is possible/feasible to access the registers directly, and what impact will that have on any gpio objects currently instatiated?

I'm new to the mbed world, but have experience with other embedded platforms, so am comfortable accessing registers if required

Thanks in advance Andrew

Question relating to:

The nRF51822-mKIT is a low cost ARM mbed enabled development board for Bluetooth® Smart designs with the nRF51822 SoC. The kit gives access to all GPIO pins via pin headers …

1 Answer

5 years, 4 months ago.

A fairly general answer since I don't have that specific board:

Yes you can hit the registers directly. The libraries define aliases for most of them that match the names in the user manual, if you look in the mbed library you can see all the defined values. e.g. taking a quick look in nrf51.h looks like the nRF51822 has 32 32bit pin config registers which at a guess are the ones you would need to change, at least none of the others in the structure seem applicable. These can be accessed using NRF_GPIO->PIN_CNF[0] to NRF_GPIO->PIN_CNF[31]

Generally the safest thing to do would be to define an mbed digital out object that is as close as possible to what you want and then manually change the drive strength setting. The libraries won't know about this change and will carry on as if it hadn't happened, unless you do something that causes the library to re-configure the pin your change should be permanent.

Accepted Answer