Dear All,
while testing an own nRF52832-based PCB and an nRF5840 PDK for current consumption, I compiled and flashed the code below to both devices. Since then I am not able to reprogram either of them. The nRF52832 is connected via its SWD port to a SEGGER J-Link programmer, whereas the nRF52840 PDK is programmed via the on-board programmer chip connected via USB.
#include "nrf_pwr_mgmt.h"
#include "nrf.h"
int main(void)
{
NRF_POWER->RAM[0].POWER= POWER_RAM_POWER_S0POWER_Off << POWER_RAM_POWER_S0POWER_Pos | POWER_RAM_POWER_S1POWER_Off << POWER_RAM_POWER_S1POWER_Pos;
NRF_POWER->RAM[1].POWER= POWER_RAM_POWER_S0POWER_Off << POWER_RAM_POWER_S0POWER_Pos | POWER_RAM_POWER_S1POWER_Off << POWER_RAM_POWER_S1POWER_Pos;
NRF_POWER->RAM[2].POWER= POWER_RAM_POWER_S0POWER_Off << POWER_RAM_POWER_S0POWER_Pos | POWER_RAM_POWER_S1POWER_Off << POWER_RAM_POWER_S1POWER_Pos;
NRF_POWER->RAM[3].POWER= POWER_RAM_POWER_S0POWER_Off << POWER_RAM_POWER_S0POWER_Pos | POWER_RAM_POWER_S1POWER_Off << POWER_RAM_POWER_S1POWER_Pos;
NRF_POWER->RAM[4].POWER= POWER_RAM_POWER_S0POWER_Off << POWER_RAM_POWER_S0POWER_Pos | POWER_RAM_POWER_S1POWER_Off << POWER_RAM_POWER_S1POWER_Pos;
NRF_POWER->RAM[5].POWER= POWER_RAM_POWER_S0POWER_Off << POWER_RAM_POWER_S0POWER_Pos | POWER_RAM_POWER_S1POWER_Off << POWER_RAM_POWER_S1POWER_Pos;
NRF_POWER->RAM[6].POWER= POWER_RAM_POWER_S0POWER_Off << POWER_RAM_POWER_S0POWER_Pos | POWER_RAM_POWER_S1POWER_Off << POWER_RAM_POWER_S1POWER_Pos;
NRF_POWER->RAM[7].POWER= POWER_RAM_POWER_S0POWER_Off << POWER_RAM_POWER_S0POWER_Pos | POWER_RAM_POWER_S1POWER_Off << POWER_RAM_POWER_S1POWER_Pos;
nrf_pwr_mgmt_init();
nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF);
}
With both setups I get the following error in uVision:
**JLink Warning: Could not read memory location 0x20000000 when trying to set soft RAM BP
Cannot setup Breakpoint at Address
Erase Failed!
When trying to erase the chip J-Flash Lite, I get the following:
If I try to drag and drop a new .hex file to the MBED drive for the nRF52840 PDK, a new file called FAIL.TXT arises and it contains: Writing target memory failed.
Any help on regaining control over the chips would be highly appreciated!
Thanks in advance!
Tamas