Page 1 of 1

Flashing firmware with st-link after failed upload

Posted: Sun Aug 20, 2023 9:54 am
by mane2
I recently uploaded binary with web interface to my Tesla SDU, and stm32 board stopped responding. Now I pulled the board out of the motor and got st-link v2 in my hand. I did not find any instructions how to do this for Small DU logic board V4. I need to find where to connect those swdio, swclk, 3.3v and gnd wires. Here’s how the board looks. Also, should I flash boot loader too, or just the stm32-sine.hex ?

Re: Flashing firmware with st-link after failed upload

Posted: Sun Aug 20, 2023 1:45 pm
by johu
Didn't your ST Link come with a straight through cable?
On the top row (i.e. where the notch is) pin 4 is SWDIO and pin 5 is SWCLK

You only need to flash the firmware, not the boot loader.

Re: Flashing firmware with st-link after failed upload

Posted: Mon Aug 21, 2023 11:28 am
by mane2
Thanks. Yes. ST-link came with 4 straight through cables.

How about 3.3v and ground? Where to plug those leads?

Re: Flashing firmware with st-link after failed upload

Posted: Tue Aug 22, 2023 8:54 am
by mane2
Found this schematic for SDU V4, but now I'm bit confused. You said top row, but notch is on the bottom and schematics show that lower row pins from left 4 & 5 have same numbers 46 & 49 as that SWPROG port above in pic.

Can you confirm that the pic is correct where I drawed the pins?

Other question is, do I need to supply 3.3v and ground when I have 12v power supply anyways? Or which power supply should I use?
pins.png
Näyttökuva 2023-8-22 kello 10.57.07.png

Re: Flashing firmware with st-link after failed upload  [SOLVED]

Posted: Tue Aug 22, 2023 12:51 pm
by royhen99
pins.png
With 12V supply connected you do not need 3.3V connected but will require a ground connection to the ST-link. The power connections marked are correct but swclk and swdat are reversed, ( should be pin 7 swdat, pin 9 swclk).

This is not a very good schematic as a label has been added for TMS_46 and TMS_49 that does not match the net name so it's not obvious they are connected to swdat and swclk.

Re: Flashing firmware with st-link after failed upload

Posted: Wed Aug 23, 2023 5:18 am
by mane2
Thanks for the info on 12v, 3.3v and ground! I guess I can choose, use either 3.3v or 12v, both will work?

Ah, my bad with picture. Of course that way! Thanks for correcting!

Agree with the schematic labels. Needs some guesswork :D

Re: Flashing firmware with st-link after failed upload

Posted: Wed Aug 23, 2023 7:43 pm
by mane2
Got it flashed! Thanks for your help.

While it was open, also tried to make a stm32-sine build using Debian running on Windows WSL. Got that uploaded via web-interface and that worked too. So all good now!

Re: Flashing firmware with st-link after failed upload

Posted: Wed Aug 23, 2023 8:20 pm
by johu
Great :)