Blink an LED in Emulated System OFF ??

kevinlbaum gravatar image

asked 2017-04-07 04:09:05 +0100

updated 2017-04-07 04:15:08 +0100

Hi, I would like to be able to provide a visual indicator such as a blinking LED when the chip is in the Emulated System OFF mode. Note that if the chip is in DEBUG mode and a System OFF command is issued, then the chip will go into emulated System OFF mode. In the reference manual, it recommends putting an infinite loop right after the System OFF instruction so that "normal" code will not be accidentally be executed. Well, instead of a loop that does nothing I would like to put code there to blink an LED. But I tried using my normal application timers and it did not seem to work. I also tried using nrf_delay_ms() but that did not work either. I hoped it would work because the reference manual says that the following subsystems are still active during Emulated System OFF: DIF, CLOCK, POWER, NVMC, MPU, CPU, CODE, and RAM. So my question: is it possible to do this, and if so what which type of timer is still functional in the emulated System OFF mode (a pointer to some sample code would be great!)? I am not using any soft device. Thanks!

edit retag flag offensive close delete report spam


Also, I am not using an IDE. I am using armgcc with a Makefile.

kmoto ( 2017-04-07 15:12:38 +0100 )editconvert to answer

2 answers

Sort by » oldest newest most voted
jornfr gravatar image

answered 2017-04-21 11:21:33 +0100

updated 2017-04-21 11:22:29 +0100

Hello Kmoto

I apologize for the late reply, we had holidays here all of last week.

I have dug further into this, and it seems it is related to the same problem as in the link I provided you earlier.

I have tested with both the old nrf_delay.h file that comes with SDK9, and the new one supplied in the link I provided. With the old file the chip will eventually enter a hardfault, but with the new file I have successfully blinked a led while in emulated system off, using both nrf_delay_ms and nrf_delay_us.

Best regards

Jørn Frøysa

edit flag offensive delete publish link more
rols gravatar image

answered 2017-04-07 04:32:13 +0100

Nowhere in that list does it say that GPIO is active in emulated system off mode so nrf_delay_ms will work but you may not be able to actually change the state of an IO line.

edit flag offensive delete publish link more


Actually I can still turn on the LED right after the System OFF command (or turn it off if it was previously on). So either GPIO is still working or there is a delay in activation of the System OFF.

kmoto ( 2017-04-07 04:55:28 +0100 )editconvert to answer

well if the GPIOs are accessible and the processor is running the nrf_delay_ms will work, so you need to work out why it's not. It doesn't do anything except execute no-ops in a loop so there's no way it can't work.

RK ( 2017-04-07 05:23:50 +0100 )editconvert to answer

What IDE are you programming with? Please see this link, and check if that solves your problem https://devzone.nordicsemi.com/questi...

Jørn ( 2017-04-07 08:24:47 +0100 )editconvert to answer

Hi Jorn, I am using nrf51822, and SDK version 9 with armgcc, not an IDE. Your link does not seem to be the same problem because I am using nrf_delay_ms() in other parts of the code and it works fine in those.

kmoto ( 2017-04-11 20:26:28 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

Question Tools

1 follower


Asked: 2017-04-07 04:09:05 +0100

Seen: 74 times

Last updated: april 21