Programming a SWD connection to external ST-LINK/V2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-05 8:49 AM - edited ‎2024-01-05 8:50 AM
Hello. I use the NUCLEO-G071RB together with the STM32CubeIDE (Ver. 1.14.0) and STM32CubeMX (Ver. 6.10.0). I completed the first prototype phase and ported the code to a custom board with a STM32G0 MCU.I used an external ST-LINK/V2 debugger to write the code to the custom board. The ST-LINK LEDs are flashing so I believe that connection is working.
However, the next step is to program a SWD connection from the custom board (MCU) to the external ST-LINK/V2. for debugging purposes.
Question: is the CMSIS-DAP interface library the best solution, or is a HAL library driver available for the SWD link? Ideally a SWD code example is available. Please advise. Thank you.
Solved! Go to Solution.
- Labels:
-
STM32Cube MCU Packages
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-05 9:31 AM
The CM0(+) devices do NOT support the SWV/SWO (Serial Wire Viewer) methods via PB3 pin
I think Keil deals with this via some Event Logger method.
You can use a circular buffer in memory that you can view in the debugger memory view.
For Serial/UART connectivity you're generally going to need ST-LINK/V3 with additional RX/TX pins wired up to a physical UART. Or you can use a serial dongle (USB-to-CMOS Serial) from SiLabs, Prolific or FTDI, or use something cheap like an RPi Nano to forward a serial connection.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-05 9:11 AM - edited ‎2024-01-05 9:14 AM
The stated request is very confusing.
ST does not provide an SWD library, not source to the ST-LINK or equivalent. The Target device normally doesn't need to do this, and the NUCLEO's typically provide a header so the on-board ST-LINK can program secondary/external devices if disconnected from the internal target. Usually a pair of jumpers.
If you want to program via a SWD/JTAG into some secondary device from your own host, yes look at CMSIS-DAP or Black Magic type source.
The HAL doesn't provide a library, the in-bound connectivity is done at the ARM Core level, and is not related to any ST peripheral.
For your external board look to connect via SWDIO, SWCLK, NRST, and have a common ground. If an external STM32 isn't connecting correctly then review the design, and focus on the power supplies, and that the device is in fact alive and functional. The original ST-LINK/V2 needs target power on Pin 1 or 2 of the head to power the buffers at a suitable voltage. Avoid ST-LINK Utilities for newer model STM32, as support stopped several years ago. Use STM32 Cube Programmer where possible.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-05 9:20 AM
Hello Tesla DeLorean, apologies for not being clear with my question.
The new custom PCB with a STM32G) MCU does not include an on-board ST-LINK debugger. Can I use printf() to send text to the external ST-LINK/V2 via a SWD connection? If yes, how do I configure that connection to pins PA13 (SWDIO) and PA14 (SWCLK)? Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-05 9:31 AM
The CM0(+) devices do NOT support the SWV/SWO (Serial Wire Viewer) methods via PB3 pin
I think Keil deals with this via some Event Logger method.
You can use a circular buffer in memory that you can view in the debugger memory view.
For Serial/UART connectivity you're generally going to need ST-LINK/V3 with additional RX/TX pins wired up to a physical UART. Or you can use a serial dongle (USB-to-CMOS Serial) from SiLabs, Prolific or FTDI, or use something cheap like an RPi Nano to forward a serial connection.
Up vote any posts that you find helpful, it shows what's working..
