Hello,
I'm trying to run my application from Segger Embedded Studio into my custom nRF52840 board but it is not working !
Preparing target for download Executing script TargetInterface.resetAndStop() Reset: Halt core after reset via DEMCR.VC_CORERESET. Reset: Reset device via AIRCR.SYSRESETREQ. Downloading ‘s140_nrf52_6.0.0_softdevice.hex’ to J-Link Programming 2.5 KB of addresses 00000000 — 00000a17 Programming 144.9 KB of addresses 00001000 — 000253c7 J-Link: Flash download: Restarting flash programming due to program error (possibly skipped erasure of half-way erased sector). J-Link: Flash download: Skip optimizations disabled for second try.
I switched to Jlink commander to get more details
I'm able to connect to the target and read it's infos
connect Device "NRF52840_XXAA" selected. Connecting to target via SWD Found SW-DP with ID 0x2BA01477 Found SW-DP with ID 0x2BA01477 AP map detection skipped. User manually configured AP map. AP[0]: AHB-AP (IDR: Not set) AP[0]: Core found AP[0]: AHB-AP ROM base: 0xE00FF000 CPUID register: 0x410FC241. Implementer code: 0x41 (ARM) Found Cortex-M4 r0p1, Little endian. FPUnit: 6 code (BP) slots and 2 literal slots CoreSight components: ROMTbl[0] @ E00FF000 ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM Cortex-M4 identified.
I'm able to erase it with "erase all" command or with nrfgo Studio, but when trying to download the firmware with loadbin I get the same error as in Segger IDE
loadbin firmware.bin,0x00000000 Halting CPU for downloading file. Downloading file [frimware.bin]... J-Link: Flash download: Restarting flash programming due to program error (possibly skipped erasure of half-way erased sector). J-Link: Flash download: Skip optimizations disabled for second try. Error while programming flash: Programming failed.
and it seems that the jlink is having a hard time switching to another page of the flash memory cause I can see that starting from address 0x00001000 the flash is still empty!
Starting to write the bin file from page 1 ( loadbin firmware.bin,0x00001000) produce the same behavior : page 2 ( 0x00002000 ) is empty
Writing bytes directly to the flash seems to work correctly :
J-Link>w4 1000,DEADBEEF Writing DEADBEEF -> 00001000 J-Link>mem 1000,4 00001000 = EF BE AD DE
I'm using the recent version of jlink 6.34b and sw to connect to the target.
I noticed that this problem was discussed here but it was more about OS system (I'm using windows) and it's 3 years ago ! I believe if it's an issue in segger firmware then most likely it is fixed already ?
do you have more details about this problem and maybe how to fix it ?