Jlink error inquiry

I am debugging with j-link.
When ethering, I sometimes stop at breakpoints and sometimes get an error.
I am using vs code and monitoring using uart at the same time.
It will show you a terminal message when uploading.

RAM:   [          ]   2.5% (used 1668 bytes from 65536 bytes)
Flash: [=         ]   5.4% (used 28268 bytes from 524288 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, dfu, jlink, serial, stlink
CURRENT: upload_protocol = jlink
Uploading .pio\build\genericSTM32F103VE\firmware.bin
SEGGER J-Link Commander V7.20 (Compiled Apr 28 2021 17:35:36)
DLL version V7.20, compiled Apr 28 2021 17:34:08


J-Link Command File read successfully.
Processing script file...

J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link V10 compiled Jun 17 2021 16:40:36
Hardware version: V10.10
S/N: 260118458
License(s): FlashBP, GDB
OEM: SEGGER-EDU
VTref=3.309V
Target connection not established yet but required for command.
Device "STM32F103VE" selected.


Connecting to target via SWD
InitTarget() start
InitTarget() end
Found SW-DP with ID 0x37401477
DAP error while determining CoreSight SoC version
InitTarget() start
InitTarget() end
Found SW-DP with ID 0x1BA01477
DPIDR: 0x1BA01477
Scanning AP map to find all available APs
AP[1]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x14770011)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x411FC231. Implementer code: 0x41 (ARM)
Found Cortex-M3 r1p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
Cortex-M3 identified.
CPU could not be halted

Downloading file [.pio\build\genericSTM32F103VE\firmware.bin]...
CPU could not be halted

****** Error: Failed to download RAMCode.
Failed to prepare for programming.
Failed to download RAMCode!
Cannot read register 16 (XPSR) while CPU is running
Cannot read register 20 (CFBP) while CPU is running
Cannot read register 0 (R0) while CPU is running
Cannot read register 1 (R1) while CPU is running
Cannot read register 2 (R2) while CPU is running
Cannot read register 3 (R3) while CPU is running
Cannot read register 4 (R4) while CPU is running
Cannot read register 5 (R5) while CPU is running
Cannot read register 6 (R6) while CPU is running
Cannot read register 7 (R7) while CPU is running
Cannot read register 8 (R8) while CPU is running
Cannot read register 9 (R9) while CPU is running
Cannot read register 10 (R10) while CPU is running
Cannot read register 11 (R11) while CPU is running
Cannot read register 12 (R12) while CPU is running
Cannot read register 14 (R14) while CPU is running
Cannot read register 15 (R15) while CPU is running
Cannot read register 17 (MSP) while CPU is running
Cannot read register 18 (PSP) wh
Unspecified error -1

Reset delay: 0 ms
Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
T-bit of XPSR is 0 but should be 1. Changed to 1.

Script processing completed.

****** Error: Could not start CPU core. (ErrorCode: -1)

I am using stm32f103vet6.
I am connecting the spi using the arduino sd library.
Let me know if there’s anything I need to do
Thank you.

Two posts at

say this can occurr when the microcontroller’s voltage shortly dips. What is the power supply of the board? If it’s battery powered, try powering it via a USB cable connection. If it’s powered by USB, try a different port (preferrably one directly on the computer, not a USB hub) or cable.

A power supply problem was suspected and the power was supplied directly through the power supply.
But I am getting a similar error.
I’d like to know if there are other issues.

RAM:   [          ]   2.5% (used 1668 bytes from 65536 bytes)
Flash: [=         ]   5.4% (used 28268 bytes from 524288 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, dfu, jlink, serial, stlink
CURRENT: upload_protocol = jlink
Uploading .pio\build\genericSTM32F103VE\firmware.bin
SEGGER J-Link Commander V7.20 (Compiled Apr 28 2021 17:35:36)
DLL version V7.20, compiled Apr 28 2021 17:34:08


J-Link Command File read successfully.
Processing script file...

J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link V10 compiled Jun 17 2021 16:40:36
Hardware version: V10.10
S/N: 260118458
License(s): FlashBP, GDB
OEM: SEGGER-EDU
VTref=3.315V
Target connection not established yet but required for command.
Device "STM32F103VE" selected.


Connecting to target via SWD
InitTarget() start
InitTarget() end
Found SW-DP with ID 0x1BA01477
DPIDR: 0x1BA01477
Scanning AP map to find all available APs
AP[1]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x14770011)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x411FC231. Implementer code: 0x41 (ARM)
Found Cortex-M3 r1p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
Cortex-M3 identified.
PC = CDCDCDCD, CycleCnt = 0157BE9C
R0 = 20000000, R1 = 00000094, R2 = 00000001, R3 = 00000000
R4 = 1A013405, R5 = 1A0177FA, R6 = 61000000, R7 = 00000001
R8 = 10080760, R9 = 00000000, R10= 10083718, R11= 02E3BFE1
R12= 00000001
SP(R13)= FFFFFFFD, MSP= FFFFFFFD, PSP= 10080760, R14(LR) = CDCDCDCD
XPSR = CDCDCDCD: APSR = NZcvQ, EPSR = 0500CC00, IPSR = 00D (PendSV)
CFBP = 00000080, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 80
FPU regs: FPU not enabled / not implemented on connected CPU.

Downloading file [.pio\build\genericSTM32F103VE\firmware.bin]...

****** Error: Failed to download RAMCode.
Failed to prepare for programming.
Failed to download RAMCode!
Unspecified error -1

Reset delay: 0 ms
Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
T-bit of XPSR is 0 but should be 1. Changed to 1.

Script processing completed.

Please ask on the Segger JLink forum why their program could be failing, along with relevant schematics / info on the hardware. When I do a quick search, the error might indicate that you’ve selected the wrong microcontroller, or the watchdog is active and interfering.