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

Program custom board via PCA10040 connector

I have custom board with NRF52832_XXAA, which I was able to (re-)flashed or erased before, but now this does not work anymore, probably after uploading some buggy code. For programming, I am using these pins:

  1. "VTG" (po +3V on board),
  2. "SWD IO",
  3. "SWD CLK" and
  4. "GND/DETECT" (to GND on custom board) to connect. NOTE: I also tried connecting my custom board's GND to GND on PCA10040 as someone already suggested previously on the forum.

My programming IDE is Eclipse Luna, I compile and link from Makefile (provided by Nordic, but slightly modified) and my project uses nRF5_SDK_12.1.0_0d23e2a and SD132 (probably not relevant). When I try to upload my firmware, i.e. Softdevice, I get this log:

--------------------------------------------------------------------------------
nrfjprog --program ../../../../../../components/softdevice/s132/hex/s132_nrf52_3.0.0_softdevice.hex --verify -f nrf52 --chiperase --log
nrfjprog verion 9.1.0
--------------------------------------------------------------------------------
FUNCTION: open_dll.
FUNCTION: open_dll.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: connect_to_emu_with_snr.
FUNCTION: connect_to_emu_with_snr.
FUNCTION: connect_to_emu_without_snr.
FUNCTION: enum_emu_snr.
Device "NRF52832_XXAA" selected.
FUNCTION: read_device_version.
FUNCTION: read_device_version.
Found SWD-DP with ID 0x2BA01477
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl 0 @ E00FF000
ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB00C SCS
ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl 0 [5]: FFF42000, CID: B105900D, PID: 000BB925 ETM
FUNCTION: readback_status.
FUNCTION: readback_status.
FUNCTION: read_region_0_size_and_source.
FUNCTION: read_region_0_size_and_source.
FUNCTION: erase_all.
FUNCTION: erase_all.
FUNCTION: sys_reset.
FUNCTION: sys_reset.
FUNCTION: read_region_0_size_and_source.
FUNCTION: read_region_0_size_and_source.
FUNCTION: disable_bprot.
FUNCTION: disable_bprot.
FUNCTION: power_ram_all.
FUNCTION: power_ram_all.
FUNCTION: write.
FUNCTION: write.
FUNCTION: write.
FUNCTION: write.
JLinkARM.dll WriteMem returned error -1.
FUNCTION: close_dll.
FUNCTION: close_dll.

On other try I got:

--------------------------------------------------------------------------------
nrfjprog --program ../../../../../../components/softdevice/s132/hex/s132_nrf52_3.0.0_softdevice.hex --verify -f nrf52 --chiperase --log
nrfjprog verion 9.1.0
--------------------------------------------------------------------------------
FUNCTION: open_dll.
FUNCTION: open_dll.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: connect_to_emu_with_snr.
FUNCTION: connect_to_emu_with_snr.
FUNCTION: connect_to_emu_without_snr.
FUNCTION: enum_emu_snr.
Device "NRF52832_XXAA" selected.
FUNCTION: read_device_version.
FUNCTION: read_device_version.
Found SWD-DP with ID 0x2BA01477
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl 0 @ E00FF000
ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB00C SCS
ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl 0 [5]: FFF42000, CID: B105900D, PID: 000BB925 ETM
FUNCTION: readback_status.
FUNCTION: readback_status.
FUNCTION: read_region_0_size_and_source.
FUNCTION: read_region_0_size_and_source.
FUNCTION: erase_all.
FUNCTION: erase_all.
FUNCTION: sys_reset.
FUNCTION: sys_reset.
JLinkARM.dll CORESIGHT_WriteAPDPReg returned error -1.
JLinkARM.dll CORESIGHT_WriteAPDPReg returned error -102.
FUNCTION: close_dll.
FUNCTION: close_dll.

I also tried to execute "--recover" command from cmd and got this:

--------------------------------------------------------------------------------
nrfjprog --recover -f NRF52 --log
nrfjprog verion 9.1.0
--------------------------------------------------------------------------------
FUNCTION: open_dll.
FUNCTION: open_dll.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: connect_to_emu_with_snr.
FUNCTION: connect_to_emu_with_snr.
FUNCTION: connect_to_emu_without_snr.
FUNCTION: enum_emu_snr.
Device "NRF52832_XXAA" selected.
FUNCTION: recover.
FUNCTION: recover.
Found SWD-DP with ID 0x2BA01477
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl 0 @ E00FF000
ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB00C SCS
ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl 0 [5]: FFF42000, CID: B105900D, PID: 000BB925 ETM
JLinkARM.dll ReadMemU32 returned error -1.
FUNCTION: close_dll.
FUNCTION: close_dll.

My command tools are:

C:\Users\Admin\Desktop>nrfjprog --version
nrfjprog version: 9.1.0
JLinkARM.dll version: 5.12g

Furthermore, my Eclipse console outputs:

22:00:07 **** Build of configuration Default for project ble_app_hids_keyboard_custom ****
make VERBOSE=1 erase 
Chip erasing: nrf52832
nrfjprog --recover -f NRF52 --log
Recovering device. This operation might take 30s.
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.
make: *** [erase] Error 33

22:00:08 Build Finished (took 683ms)

What is wrong?

Is it possible that I locked nrf's CPU?


P.S.: I tried several things to overcome this error:

1. ON/OFF my PCA10040,

2. USB to board IN/OUT,

3. every combination of applying supply to custom board at different stages of programming,

4. Windows logout and OS shutdown/reboot, etc.

but nothing seems to work.

What else can I try??

Related