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

Problem to debug NET CPU after segger update and new nrf5340 chip

Hi i  m evaluating the nrf5340 and i get this message when i try to download the code to NET cpu and it's a bit impossible to attach the debugger

CTRL-AP indicates that the device is secured.

For debugger connection the device needs to be unsecured.
Note: Unsecuring will trigger a mass erase of the internal flash, SRAM and UICR of both the application and the network core.

How to unsecure permanently?

Thank you!

  • Hi Emag!

    Correct, the nRF53 series (and soon the nRF52's) comes with APPROTECT being enabled as default. It is basically read/writing protected until it is programmed not to be. In order to circumvent this temporarily however you can recover it:

    nrfjprog --recover --coprocessor CP_NETWORK
    nrfjprog --recover

    To unsecure "permanently" (ie. having it disabled after flashing) you need to write to

    UICR.APPROTECT and CTRL-AP.APPROTECT.DISABLE

    for both the app and network core. Though this wouldn't really be permanent either, as flashing anything like a sample project can revert it back to the default. For more info about this see here.

    Best regards,

    Håkon

  • Thank you Elfving,  so if i put in the NET Code at main this 

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

    and in APP code at main this 

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

    do you think it can solve and let me attach the debugger to see the code?

    I need to debug the NET core because after a while i stop the RTC0 and put the core to _WFI waiting an accelerometer interrupt to wake up.

    But after the GPIOTE interrupt i try to restart RTC0 but the counter seems very slow i haven't RTC0 interrupts.

    Now the workaround is to NVIC_DisableIRQ(RTC0_IRQ) and NVIC_EnableIRQ(RCT0_IRQ) when wake up.

    In the previous chip this problem was not present. So now with the default APProtect is a caos to debug when i try to attach the memory is erased.

    Best regards,
    emag

  • Yes, I think that would work. Let me know if it doesn't.

    Hopefully this will make the rest easier to debug. If you need help with the RTCO counter issue, please address that in a new devzone case in order to keep the issues separated and on topic.

    Best regards,

    Håkon

Related