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

nRF53 Device is Protected after programming and I cannot debug

When i program our new nRF5340 based radio boards the program returns Device Protected for both cores on completion. It is also impossible to debug the board as my segger refuses to connect.

I found a case with a similar issue:

https://devzone.nordicsemi.com/f/nordic-q-a/75406/problem-to-debug-net-cpu-after-segger-update-and-new-nrf5340-chip?ReplySortBy=CreatedDate&ReplySortOrder=Descending

and have tried the suggested solution of:

put the following in the NET Code at the start of main:

NRF_UICR_NS->APPROTECT=0x50fa50fa;
NRF_CTRLAP_NS->APPROTECT.DISABLE=0x50fa50fa;

put the following in the  APP Code the start of main:

NRF_UICR_S->APPROTECT=0x50fa50fa;
NRF_CTRLAP_S->APPROTECT.DISABLE=0x50fa50fa;

This does seem to allow the debugger to connect, However i get a hard fault from the command.

Is there a suggested way around this issue?

Parents Reply Children
  • I m stuck i try to attach the debug the flash erases. Sometime it works other not.

    I have the NET core that needs to update the firmware flash and it's impossible to debug it.

    problems:

    - it's not clear if it's possible to write the NET core from the APP core in case of yes it makes firmware update simpler.

    - it's not clear how to disable protection from firmware to let debug to attach in NET core

    - the info in the datasheet are not clear about lot of protect and disable protect and flash uicr bah!!!!

    I'll abandon nr5340 to many time wasted in problems not related to the development of the code

    bye

  • I am using nRFProg to write the image through a Segger j-link ( I have upgraded to the latest Segger as well). This works fine with the older nRF52 boards. and also when i program a PDK. But as soon as I program our target the nRFProg reports that the device is locked.

    Next time i wish to program the device i have to do an erase all to unlock it. I have seen it work for an hour or a few hours such that i can program it and it comes back unlocked so that i am able to debug it but after a period, maybe the next day it wil revert to programming as locked

  • Not I am using the Programmer built into nRF Connect and just drag the images in so I wouldn't expect an issue.

    As soon as i program the device the nRF Connect programmer reports it as protected

  • every time there is a reset the protection goes on erasing all automatically.

    It's a lot disturbing, now i need to update the NET core but i m not able to debug.

    I enable FLASH ERASE then writing 0xFFFFFFFF on 0xFFFFF000 boundaries then the page is erased ready to write the code. In APP it's ok in NET no but how to debug????

  •  But in nrf5340 revision A it was working all very good. Debugging Net Core was very simple.

    Now with revision D  i m wasting lot of time.  

    i have added this 

    NRF_NVMC_NS->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos);
    while (NRF_NVMC_NS->READY == NVMC_READY_READY_Busy) {};
    NRF_UICR_NS->APPROTECT=0x50fa50fa;
    while (NRF_NVMC_NS->READY == NVMC_READY_READY_Busy) {}
    NRF_NVMC_NS->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos);
    while (NRF_NVMC_NS->READY == NVMC_READY_READY_Busy){};
    NRF_CTRLAP_NS->APPROTECT.DISABLE=0x50fa50fa;

    in NET core at main function

    and this in APP main

    NRF_NVMC_S->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos);
    while (NRF_NVMC_S->READY == NVMC_READY_READY_Busy) {};
    NRF_UICR_S->APPROTECT=0x50fa50fa;
    while (NRF_NVMC_S->READY == NVMC_READY_READY_Busy) {}
    NRF_NVMC_S->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos);
    while (NRF_NVMC_S->READY == NVMC_READY_READY_Busy){};
    NRF_CTRLAP_S->APPROTECT.DISABLE=0x50fa50fa;
    NRF_CTRLAP_S->SECUREAPPROTECT.DISABLE=1;

    so i m expecting  to attach the debug without problems but not.

    So  HOW TO  DO?

    Thank you!

Related