7
32
Fork
You've already forked blackmagic
23

Can't connect via JTAG to STM32L4R #2241

Closed
opened 2026年04月27日 21:39:06 +02:00 by esden · 0 comments
Owner
Copy link

I am getting a Error erasing flash with vFlashErase packet when trying to connect using JTAG to the device. It works fine using SWD.

Here is the BMDA log of the interaction:

> ./build/blackmagic -s 6DA48568 -v 5
Black Magic Debug App v2.0.0-515-gb79287d75
 for Black Magic Probe, ST-Link v2 and v3, CMSIS-DAP, J-Link, FTDI (MPSSE) and WCH-Link
Using 1d50:6018 6DA48568 Black Magic Debug
 Black Magic Probe v3 v2.0.0-515-gb79287d7
Setting V6ONLY to off for dual stack listening.
Listening on TCP port: 2000
Got connection
Speed set to 5.000MHz for JTAG
Resetting TAP
Change state to Shift-DR
Scanning out ID codes
Return to Run-Test/Idle
Change state to Shift-IR
Scanning out IRs
Return to Run-Test/Idle
Change state to Shift-DR
Return to Run-Test/Idle
ID code 0x4ba00477: ADIv5 JTAG-DP port.
ID code 0x06471041: STM32 BSD.
DPv0 detected based on JTAG IDCode
AP 0: IDR=24770011 CFG=00000000 BASE=e00ff000 CSW=e3000040 (AHB3-AP var1 rev2)
Halt via DHCSR(00030003): success after 4ms
ROM Table: BASE=0xe00ff000 SYSMEM=1, Manufacturer 020 Partno 470 (PIDR = 0x00000a0470)
0 0x0e000e000: Generic IP component - Cortex-M4 SCS (System Control Space) (PIDR = 0x04000bb00c DEVTYPE = 0x00 ARCHID = 0x0000)
-> cortexm_probe
CPUID 0x410fc241 (M4 var 0 rev 1)
cortexm_probe: Examining Part ID 0x0470, AP Part ID: 0x0470
Calling stm32f1_probe
Calling stm32f4_probe
Calling stm32h5_probe
Calling stm32h7_probe
Calling stm32mp15_cm4_probe
Calling stm32l0_probe
Calling stm32l1_probe
Calling stm32l4_probe
1 0x0e0001000: Generic IP component - Cortex-M3 DWT (Data Watchpoint and Trace) (PIDR = 0x04003bb002 DEVTYPE = 0x00 ARCHID = 0x0000)
2 0x0e0002000: Generic IP component - Cortex-M3 FBP (Flash Patch and Breakpoint) (PIDR = 0x04002bb003 DEVTYPE = 0x00 ARCHID = 0x0000)
3 0x0e0000000: Generic IP component - Cortex-M3 ITM (Instrumentation Trace Module) (PIDR = 0x04003bb001 DEVTYPE = 0x00 ARCHID = 0x0000)
4 0x0e0040000: Debug component - Cortex-M4 TPIU (Trace Port Interface Unit) (PIDR = 0x04000bb9a1 DEVTYPE = 0x11 ARCHID = 0x0000)
5 0x0e0041000: Debug component - Cortex-M4 ETM (Embedded Trace) (PIDR = 0x04000bb925 DEVTYPE = 0x13 ARCHID = 0x0000)
ROM Table: END
Resuming target
Attaching to target..
Halting target
Target halted: Halt requested
Attach success
Resetting target
Exception caught while detaching from target: Remote protocol exception
TARGET LOST.

I have bisected the issue and narrowed it down to 32c8fd6930 being the first commit that introduces the issue. The connection erase flash and section compare works fine before this commit.

I am getting a `Error erasing flash with vFlashErase packet` when trying to connect using JTAG to the device. It works fine using SWD. Here is the BMDA log of the interaction: ``` > ./build/blackmagic -s 6DA48568 -v 5 Black Magic Debug App v2.0.0-515-gb79287d75 for Black Magic Probe, ST-Link v2 and v3, CMSIS-DAP, J-Link, FTDI (MPSSE) and WCH-Link Using 1d50:6018 6DA48568 Black Magic Debug Black Magic Probe v3 v2.0.0-515-gb79287d7 Setting V6ONLY to off for dual stack listening. Listening on TCP port: 2000 Got connection Speed set to 5.000MHz for JTAG Resetting TAP Change state to Shift-DR Scanning out ID codes Return to Run-Test/Idle Change state to Shift-IR Scanning out IRs Return to Run-Test/Idle Change state to Shift-DR Return to Run-Test/Idle ID code 0x4ba00477: ADIv5 JTAG-DP port. ID code 0x06471041: STM32 BSD. DPv0 detected based on JTAG IDCode AP 0: IDR=24770011 CFG=00000000 BASE=e00ff000 CSW=e3000040 (AHB3-AP var1 rev2) Halt via DHCSR(00030003): success after 4ms ROM Table: BASE=0xe00ff000 SYSMEM=1, Manufacturer 020 Partno 470 (PIDR = 0x00000a0470) 0 0x0e000e000: Generic IP component - Cortex-M4 SCS (System Control Space) (PIDR = 0x04000bb00c DEVTYPE = 0x00 ARCHID = 0x0000) -> cortexm_probe CPUID 0x410fc241 (M4 var 0 rev 1) cortexm_probe: Examining Part ID 0x0470, AP Part ID: 0x0470 Calling stm32f1_probe Calling stm32f4_probe Calling stm32h5_probe Calling stm32h7_probe Calling stm32mp15_cm4_probe Calling stm32l0_probe Calling stm32l1_probe Calling stm32l4_probe 1 0x0e0001000: Generic IP component - Cortex-M3 DWT (Data Watchpoint and Trace) (PIDR = 0x04003bb002 DEVTYPE = 0x00 ARCHID = 0x0000) 2 0x0e0002000: Generic IP component - Cortex-M3 FBP (Flash Patch and Breakpoint) (PIDR = 0x04002bb003 DEVTYPE = 0x00 ARCHID = 0x0000) 3 0x0e0000000: Generic IP component - Cortex-M3 ITM (Instrumentation Trace Module) (PIDR = 0x04003bb001 DEVTYPE = 0x00 ARCHID = 0x0000) 4 0x0e0040000: Debug component - Cortex-M4 TPIU (Trace Port Interface Unit) (PIDR = 0x04000bb9a1 DEVTYPE = 0x11 ARCHID = 0x0000) 5 0x0e0041000: Debug component - Cortex-M4 ETM (Embedded Trace) (PIDR = 0x04000bb925 DEVTYPE = 0x13 ARCHID = 0x0000) ROM Table: END Resuming target Attaching to target.. Halting target Target halted: Halt requested Attach success Resetting target Exception caught while detaching from target: Remote protocol exception TARGET LOST. ``` I have bisected the issue and narrowed it down to 32c8fd693018f9b7d7b7651ecebe17a781612ce0 being the first commit that introduces the issue. The connection erase flash and section compare works fine before this commit.
Sign in to join this conversation.
No Branch/Tag specified
main
fix/pre-bmp-v3-cross-file-cleanup
feature/bmda-remote-comms
ALTracer/feature/aarch64-ident
feature/better-meson-optimisation-handling
feature/am335x-support
feature/esp32-c3-support
feature/cortex-ar-software-breakpoints
feature/unit-testing
feature/windows-usb-serial-interface-naming
fix/bmp-external-spi
ALTracer/feature/bluepillplus-platform
ALTracer/feature/at32f43x-unrdp
feature/const-correctness
ALTracer/feature/fault_handlers
ALTracer/feature/hazard3-ice40-support
fix/ci-cleanup
ALTracer/fix/gdb-10-12-thread
ALTracer/feature/blackpill-f4-adc
ALTracer/fix/cortex-desc-allocfail-report
ALTracer/feature/spi-perf
ALTracer/feature/calibrate_swd
ALTracer/feature/blank-check
feature/avr
v2.0
v1.9
v1.10
v1.8
v2.1.0-rc1
v2.0.0
v2.0.0-rc2
v2.0.0-rc1
v1.9.3
v1.10.2
v1.10.1
v1.10.0
v1.10.0-rc1
v1.10.0-rc0
v1.9.2
v1.8.3
v1.9.1
v1.9.0
v1.9.0-rc1
v1.9.0-rc0
v1.8.2
v1.8.1
v1.8.0
v1.7.1
v1.7
v1.6.2-rc1
1.6.2-rc0
v1.6.1
v1.6
v1.6-rc1
v1.6-rc0
production_01
production_00
Labels
Clear labels
BMD App
Black Magic Debug App (aka. PC hosted) (not firmware)
BMP Firmware
Black Magic Probe Firmware (not PC hosted software)
Bug
Confirmed bug
Build system
Build system
Can't reproduce
Maintainers can't reproduce this problem
CI
Continuous Integration System
Contribution wanted
User contributions welcome
Documentation
Project documentation
Draft
Work in progress draft
Duplicate
This issue or pull request already exists
Enhancement
General project improvement
Feedback wanted
Requires additional submitter feedback
Foreign Host Board
Non Native hardware to runing Black Magic firmware on
GDB
Issue/PR related to GDB
Good first issue
Good for newcommers
HwIssue Mitigation
Solving or mitigating a Hardware issue in Software
Information Needed
Maintainers need more information
NativeHardware
Official Black Magic Debug Hardware
New Host Board
New hardware to run Black Magic firmware on
New Target
New debug target
Off Topic
Something that does not involve the project in any way
Potential Bug
A potential, unconfirmed or very special circumstance bug
Regression
Bug caused by a regression
User Interest Needed
More user interest required before consideration
User Testing Needed
Looking for user testing reports
Won't fix
Outside of the project scope or works as intended
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
blackmagic-debug/blackmagic#2241
Reference in a new issue
blackmagic-debug/blackmagic
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?