Programming secondary chip using SWD interface
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-18 7:00 AM
Hi
I have a chip in main board that can be programmed using SWD interface.
- Can I use the SWD of the STM32F407 to program another chip (and not just for programming and debugging the STM32) ?
- If so - Are there any HAL functions ?
Thanks
- Labels:
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-18 7:08 AM
Embedding debug probe function is far from simple. Typically bootoader enables reflashing through uart, i2c, spi. Application code on target for in application programming is another way. HAL doesn't provide SWD serial function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-18 7:12 AM
That would be a kind of daisy chain, but no, unfortunately this is not possible with SWD and there are no functions for it.
Regards
/Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-18 8:56 AM
Hi Peter, I'm not sure you understood me correctly.
I'm not trying to program from PC to the STM32 and from then to the other chip.
I'm trying to control the STM32 to program the other chip directly with no other host.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-18 9:02 AM
Hi
I'm sure it is not a simple task, but I might be doing it if it technically possible.
I see in the reference manual: https://www.st.com/resource/en/reference_manual/dm00031020-stm32f405-415-stm32f407-417-stm32f427-437-and-stm32f429-439-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdf
page 1695 a list of registers that may help me doing this task.
Is someone ever did it ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-18 9:22 AM
Daisy chain or not, it's not supported. The SWD pins are only for programming that device.
You can certainly emulate the SWD protocol using other pins (or even the SWD pins), but that's not a realistic solution and certainly isn't supported in HAL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-18 9:37 AM
The way people typically program down-stream MCU is via an NRST, BOOT0 and USART pins using the System Loader (See AN2606)
Or via your own loader protocol if that is easier, or more convenient.
Perhaps look over the IAP examples, this will be orders of magnitude simpler than implementing SWD/JTAG on ARM MCU and pushing loaders, code, etc. For the latter case, perhaps look at ARM's documentation for debugger writers/developers.
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
‎2021-10-18 9:40 AM
The SWD protocol on the MCU side is implemented in hardware. It's not designed to host other devices, and is not inherently a software/firmware based method. ie combinational/synchronous logic clocking into the 10's of MHz
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
‎2021-10-18 10:29 AM
The ST-LINK debugger itself is a STM32 so it should be possible; you are free to learn the protocol and try.
As TDK wrote, this is not the most pragmatic path.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-18 3:19 PM
"Can I use the SWD of the STM32F407 to program another chip"
No. The SWD in the microcontroller is a "slave" - it can't be a "master" to another microcontroller.
Have you looked at CMSIS DAP ?
https://os.mbed.com/handbook/CMSIS-DAP
A complex system designed from scratch never works and cannot be patched up to make it work.
