cancel
Showing results for 
Search instead for 
Did you mean: 

Programming secondary chip using SWD interface

Ofer
Associate III

Hi

I have a chip in main board that can be programmed using SWD interface.

  1. Can I use the SWD of the STM32F407 to program another chip (and not just for programming and debugging the STM32) ?
  2. If so - Are there any HAL functions ?

Thanks

15 REPLIES 15

Indeed, but it's pretty involved, with a complete firmware to do it, and host side windows code to boot.

JTAG and scan chains aren't inherently complex concepts, but its the details, sequences and code injection. You have to be able to stage the update image, and manage everything as a bit stream. You could use QSPI-Flash, USB-Flash or MicroSD cards for large images.

Perhaps as Andrew suggests look at the CMSIS-DAP, and also the BIack Magic probe

Then compare that with say an implementation for X-Modem, something one should be able to white-board the mechanics for in an interview

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Ofer
Associate III

Thanks to all of you for your answers.

It is not urgent task, but I have to select the pinout to the board.

I will try both options (using the SWD of the STM + using simple GPIOs for bit-banging)

Consider programming the other chip with the bootloader and controlling it with GPIOs connected to the BOOT0 pin, the NRST pin, and the relevant bootloader communication method such as UART. This will be much easier than using SWD.
If you feel a post has answered your question, please click "Accept as Solution".

As @TDK​ says, using a bootloader would be the conventional - and (probably) far easier - approach.

@Ofer​ "simple GPIOs for bit-banding (sic?)"

I think you mean bit-banging ?

Bit Banding is something different: https://developer.arm.com/documentation/ddi0337/h/Behcjiic (you might use Bit Banding to do your bit-banging).

Thematically similar https://community.st.com/s/question/0D53W000019DrSlSAK/flash-loader-with-another-mcu

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Yes, you are right