7 years, 10 months ago.

What is the fastest way to turn-on a GPIO from power-on?

I'm developing a project in mbed for the nRF51822 chip. Currently using the nRF51-DK board for prototyping.

I need the chip to turn on GPIO pin on (setting it high) as fast as possible after start-up. Currently it's taking 350ms looking on my oscilloscope... This seems pretty huge...

My code is not doing anything much beyond starting-up and setting this pin. It sets-up Serial objects & one or two other pins a bit later, but I try to set the pin's initial value as quickly as possible using: - DigitalOut(thePin,1);

What some ways (if any) I could improve this start-up time?

I know that, often, the big delays in start-up are to do with starting oscillators and perhaps the nRF51's DC/DC converter if it's using that.

Are there any standard mbed ways to quickly set a GPIO as fast as possible before any other code is executed?

Any other suggestions to reduce start-up time?

Could you add a pull up resistor?

posted by Andy A 15 Jun 2016

No, the pin is connected where a pull-down resistor is needed. A little more info: The GPIO in question is for a "keep alive" circuit whereby the GPIO sets an LDO enable pin to high therefore keeping the LDO on once the nRF51822 has started.

The purpose here is that the LDO enable is connected to the battery via pushbutton, the user presses the pushbutton and turns the LDO on 1st time (LDO takes 50uS to start). The nRF51822 then begins powering-up (now it has input power from LDO) and it's 1st job is to keep the LDO alive (so it can then turn it off later). A simple RC-discharge circuit keeps the LDO enable line high enough during the time between pushbutton release and nRF51822 GPIO setting high.

So, 350ms is quite a long time for this purpose, still possible, but not ideal. I have read that if using en external clock source the start-up time is increased to between 300-1000ms so I believe this may be the issue. I'm currently looking at changing to the internal oscillator, atleast for start-up....

posted by CJ Shaw 15 Jun 2016

I can confirm that, having just crudely changed the clock-source in "system_nrf51.c" to the low-frequency clock the device now starts in 100ms.

(File found in mbed-dev/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/system_nrf51.c")

This is consistent with the data for an nRF51822 operating with 1.8V Vdd... I know there's lots of options for power-input to this chip & dev. board so I'll investigate whether it's really working at 1.8V next...

posted by CJ Shaw 15 Jun 2016
Be the first to answer this question.