nRF52833 (Custom Board) halts when JLink is connected

Update: 

Turns out it was an issue with the readback protection. We have a temporary fix of calling the following function at boot.

void approtect_hw_disable(void)
{
    if ((NRF_UICR->APPROTECT & UICR_APPROTECT_PALL_Msk) == (UICR_APPROTECT_PALL_Msk))
    {
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
        {
        }
        NRF_UICR->APPROTECT = (UICR_APPROTECT_PALL_HwDisabled << UICR_APPROTECT_PALL_Pos);
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
        {
        }
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
        {
        }
        NVIC_SystemReset();
    }
}

Is there a way to configure this in Kconfig or Devicetree? 

Original Post:

Hello!

We have just received a new revision of our device's PCBA and are having issues getting RTT output. 

When we program the board, it successfully flashes and runs. We can power cycle the board and it will come back on just fine. It also works fine during debugging, we get an RTT output and we can step through the program. 

However, when we have the JLink connected and run `JLinkExe` (or connect the nRF Connect SDK RTT Client) the board seems to get stuck in a reset state. The program doesn't run and doesn't recover when power cycled. The RTT client just says:

SEGGER J-Link V7.70a - Real time terminal output
SEGGER J-Link ARM V11.0, SN=821006534
Process: JLinkExe

A second issue we have is that every 5 or so attempts at programming the device we are prompted that there is read protection and we need to recover the device. We are unsure why this is happening as we have not enabled read protection. 

Neither of these issues is present on our previous PCBA. The new PCBA is quite different from the old one but as the code is working correctly when debugging we don't think it's an assembly or schematic issue.

We would appreciate any ideas on the cause of these issues and any steps we can take to debug them. 

Many Thanks,
Archie

Parents Reply
  • Hi Vidar,


    Thank you for the reply. Are you saying that as long as you recover the device once, it will no longer have readback protection? If this is the case, it does not line up with what we are seeing. Without the code detailed in the above post, readback protection is reenabled each time we power cycle the device. I have checked and ENABLE_APPROTECT has not been defined. 

Children
Related