This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

In S110 SoftDevice, NRF_POWER->SYSTEMOFF is written. Why?

Hello.

I'm now writing a software based on nrf51_sdk_v6_1_0/nrf51822/Board/nrf6310/s110/ble_app_hrs. The SoftDevice I'm using is s110_nrf51822_7.1.0_softdevice.hex. Why I use the version is that the target device is IC revision 2. Exactly speaking, it is nRF51822 QFAAG20 (0x0057).

When I run the code, it is working for a while (just advertising without connection). However after a few minutes later, the software crashes by HardFault. When I checked the stack area, I noticed that the RAM Block 0 and 1 looked all filled with zero. I suspected that NRF_POWER->RAMON had a wrong value but it was 0x00000003. It looked fine. However, I also noticed that the memory area would be preserved when I reset the target. Finally I noticed that writing 1 to NRF_POWER->SYSTEMOFF caused a similar phenomenon.

So I had a watchpoint on the NRF_POWER->SYSTEMOFF (0x40000500) and reran the code. By the watchpoint, I found that a code in the SoftDevice was writing 1 to the SYSTEMOFF register. It is the following code.

0x00011328: ldr r1, [pc, #424]  ; 0x114d4
0x0001132a: movs r0, #1
0x0001132c: str r0, [r1, #0]

I also confirmed that the code was called in the IRQ #11 context (RTC0_IRQ).

I guess that there is an intention that SoftDevice triggers the SYSTEMOFF, but I don't imagine the reason.

FYI, I suspected that heap or stack area was flooded but it looked okay.

Could you please let me know when and why SoftDevice triggers the SYSTEMOFF? (Do we still have a way to access RAM even though SYSTEMOFF == 1?)

Best Regards,

Atsushi

Related