nrf52840 restarting, code run in RAM

Hello,

We have to program an external QSPI flash which is connected to an nrf52840 SoC using the J-Flash application from SEGGER.

For this requirement I followed the instruction for the SEGGER website: https://wiki.segger.com/Open_Flashloader

from where I downloaded the most appropriated template: https://wiki.segger.com/images/5/52/OFL_Template_CortexM.zip

Then I modified the template to work with the nrf52840 SoC, 

I mention that the code will run on the RAM. So it is not need to program the SoC in order to program the external QSPI flash. The J-Flash application from SEGGER is calling the required functions (chip erase, program, verify...). 

So using the SEGGER template, when I want to do some debugging to check these functions for some reason SoC restarting.

Even if I have in the Main function an empty function (EmplyFunction()) the SoC still restarting.

I requested technical support from SEGGER (see the attached email).

I the attachment you can find some screenshots and also the source code of the modified template.

I tried to find out the reason why is restarting by checking the RESETREAS register.

int u32Reset_reason = NRF_POWER->RESETREAS;

the u32Reset_reason is 5d. But I think is approach to check the RESTREAS register is not ok, because in order to check that register again i have to run again the code and then the debugger restarting the SoC.

First I tried the QSPI example from the SDK folder and is working without the restarting issue. I can read, erase, program the external QSPI flash. But I cannot use this template because the code is running on the flash of SoC.

I think i not updated the template correctly. 

until here is ok:

here the SoC restarted:

Source code of the modified template:

 flashloader.zip

Reply from SEGGER:

re flashloader ram code issue inquiry#60267017.msg

Thank you in advance.

Related