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

Post Reply
User avatar
mane2
Posts: 251
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 40 times
Been thanked: 41 times

Flashing firmware with st-link after failed upload

Post 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 ?
You do not have the required permissions to view the files attached to this post.
User avatar
johu
Site Admin
Posts: 6772
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 385 times
Been thanked: 1595 times
Contact:

Re: Flashing firmware with st-link after failed upload

Post 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.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
mane2
Posts: 251
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 40 times
Been thanked: 41 times

Re: Flashing firmware with st-link after failed upload

Post by mane2 »

Thanks. Yes. ST-link came with 4 straight through cables.

How about 3.3v and ground? Where to plug those leads?
User avatar
mane2
Posts: 251
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 40 times
Been thanked: 41 times

Re: Flashing firmware with st-link after failed upload

Post 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
You do not have the required permissions to view the files attached to this post.
royhen99
Posts: 262
Joined: Sun Feb 20, 2022 4:23 am
Location: N. Wiltshire. UK
Has thanked: 22 times
Been thanked: 133 times

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

Post 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.
You do not have the required permissions to view the files attached to this post.
User avatar
mane2
Posts: 251
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 40 times
Been thanked: 41 times

Re: Flashing firmware with st-link after failed upload

Post 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
User avatar
mane2
Posts: 251
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 40 times
Been thanked: 41 times

Re: Flashing firmware with st-link after failed upload

Post 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!
User avatar
johu
Site Admin
Posts: 6772
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 385 times
Been thanked: 1595 times
Contact:

Re: Flashing firmware with st-link after failed upload

Post by johu »

Great :)
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Post Reply