Unable to reprogram the nrf52840 chip.

I am using the nrf52840 chip on a custom made PCB that is powered by a USB-C which provides it with 5V.This 5V is then converted to 12V using CH224K which then is wired to a regulator(

EA8212FT6R) to step down the voltage to 3.3V to power the nrf chip.The reason for the step up to 12V in the 1st place, is to power a heat meter device via the PCB.Everything initially works fine where I am able to power my device while at the same time,I am able to program my chip with a new firmware via the debug port on the PCB(GND,VDD,SWDIO,SCLK). However,after a few firmware reprogramming cycles ,I am unable to reprogram and face an error:

Flashing: _build/nrf52840_xxaa.hex
nrfjprog -f nrf52 --program _build/nrf52840_xxaa.hex --sectorerase
[error] [ Client] - Encountered error -102: Command read_device_info executed for 124 milliseconds with result -102
[error] [ Worker] - An unknown error.
[error] [ Client] - Encountered error -102: Command read_memory_descriptors executed for 21 milliseconds with result -102
Failed to read device memories.
[error] [ Worker] - An unknown error.
ERROR: JLinkARM DLL reported an error. Try again. If error condition
ERROR: persists, run the same command again with argument --log, contact Nordic
ERROR: Semiconductor and provide the generated log.log file to them.
NOTE: For additional output, try running again with logging enabled (--log).
NOTE: Any generated log error messages will be displayed.
make: *** [flash] Error 33

On further investigation, the SWDIO pin on the debug port of the PCB shows me 0V while it should have been 3.3V instead.It also is not shorted to the ground(checked via continuity on the multimeter).My nrf2 chip seems to still be working as I am able to get logs from the debug port ,hence the chip is still running the firmware from the last successful flash.However,its not being able to reflash the latest code due to the SWDIO pin.I don't understand what could be possibly causing it as according to my schematics, there is no connection of the SWDIO pin with any other component on the PCB except the only straight forward connection it has is between the debug port and nrf52 chip.The nrf52 chip also receives stable 3.3V supply from the EA8212FT6R regulator.

The other error displayed for me via nrf connect programmer is 

Failed "reading readback protection status for application core". Error: code: 1, description: Generic, message: Batch task protection-get failed, [Probe] Device error: Failed to write DebugPort register 2: Unknown Error in J-Link DLL (error code =-1)
09:31:33.582
Error: Failed with exit code 1. One or more batch tasks failed: - [Probe] Device error: Failed to write DebugPort register 2: Unknown Error in J-Link DLL (error code =-1), code: Generic. Message: Batch task protection-get failed, [Probe] Device error: Failed to write DebugPort register 2: Unknown Error in J-Link DLL (error code =-1).
09:31:33.582
Error: Failed with exit code 1. One or more batch tasks failed: - [Probe] Device error: Failed to write DebugPort register 2: Unknown Error in J-Link DLL (error code =-1), code: Generic. Message: Batch task protection-get failed, [Probe] Device error: Failed to write DebugPort register 2: Unknown Error in J-Link DLL (error code =-1).
I have also tried nrfjprog --recover which hasn't worked owing to  the. SWDIO pin being low.
Any suggestions on what I could do to figure out the reason behind this issue ?

 

Related