I've been using the nRF52840 dongles with a J-Link Plus for over a year now - they generally work great. I am using them without the mbed bootloader, and programming/debugging my code using the bottom 2x5 pads with the appropriate connector to the J-Link.
Every so often, I will flash my program on to them and the J-Link status LED will stay amber instead of coming back to green after the programming operation. When this happens I know that once again, the internal regulator has been disabled and I have to play with SB1 and SB2 and inject 3.3V on to the VDD net in order to restore the device.
When this happens, the J-Link cannot talk to the device. Until I remove power after flashing, the "st" (status) command in JLinkExe tells me that VTRef is 1.8V (which should be sufficient) and it can no longer talk to the part because the core is powered down:
Target connection not established yet but required for command. Device "NRF52840_XXAA" selected. Connecting to target via SWD Found SW-DP with ID 0x2BA01477 Found SW-DP with ID 0x2BA01477 Could not power-up debug power domain. Scanning AP map to find all available APs AP[0]: Stopped AP scan as end of AP map has been reached Iterating through AP map to find AHB-AP to use ****** Error: Could not find core in Coresight setup
Once I cycle power to the dongle, VTref will be stuck at 0.4V and it's time to inject voltage on VDD.
Something is shutting off the internal regulator and I can't figure out what it is. My program does NOT touch flash, only USB, timers and the radio. I am not using a soft device. There is no other hardware physically connected other than the PC through the USB contacts and the J-Link Plus through the 2x5 header connector on the bottom of the board.
At one point I thought the issue was that the UICR registers were getting corrupted. I added this function which executes on power-up, but this is not the cause of the issue since this code was not present when I bricked this last dongle. I added it (without any other change to my program) and flashed a second dongle, and it too become bricked:
/*
* sets the REGOUT0 voltage to 3.3V
* sets the P0.9/10 to GPIO (default is NFC)
* only does this if the register is at its erased default
* performs a system reset afterward
*/
static void _set_uicr(void)
{
bool update;
update = false;
if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) == (UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos)) {
update = true;
}
if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)) {
update = true;
}
if (update) {
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) ;
NRF_UICR->REGOUT0 = (NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) | (UICR_REGOUT0_VOUT_3V3 << UICR_REGOUT0_VOUT_Pos);
NRF_UICR->NFCPINS = UICR_NFCPINS_PROTECT_Disabled;
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) ;
NVIC_SystemReset();
}
}
I'd really like some help in figuring out WHY this is occurring. There are others seeing the same thing but the replies are about restoring the device, not figuring why it happened in the first place.