UART Firmware updating not working.

Post Reply
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

UART Firmware updating not working.

Post by Bigpie »

I've got FFMans V1C board from Damien with me to try him get it going, but it's behaving a little off.

I can upload the bootloader with stm32cube, then on the UART I get 2D2D2D recurring. (Version 3)
If I them upload a hex file of any version via stm32cube, it runs that firmware.
Screenshot 2022-09-14 at 2.19.18 pm.png
Any attempt to upload via uart leaves the flash empty after 0x0800100
Screenshot 2022-09-14 at 2.16.01 pm.png

Code: Select all

python updater.py -d /dev/tty.usbserial-1420 -f /Users/jamiejones/Downloads/stm32_sine.bin 
File length is 41200 bytes/41 pages
Resetting device...
Version 2 bootloader, sending magic
Sending number of pages...
Sending page 0... CRC correct!
Sending page 1... CRC correct!
Sending page 2... CRC correct!
Sending page 3... CRC correct!
Sending page 4... CRC correct!
Sending page 5... CRC correct!
Sending page 6... CRC correct!
Sending page 7... CRC correct!
Sending page 8... CRC correct!
Sending page 9... CRC correct!
Sending page 10... CRC correct!
Sending page 11... CRC correct!
Sending page 12... CRC correct!
Sending page 13... CRC correct!
Sending page 14... CRC correct!
Sending page 15... CRC correct!
Sending page 16... CRC correct!
Sending page 17... CRC correct!
Sending page 18... CRC correct!
Sending page 19... CRC correct!
Sending page 20... CRC correct!
Sending page 21... CRC correct!
Sending page 22... CRC correct!
Sending page 23... CRC correct!
Sending page 24... CRC correct!
Sending page 25... CRC correct!
Sending page 26... CRC correct!
Sending page 27... CRC correct!
Sending page 28... CRC correct!
Sending page 29... CRC correct!
Sending page 30... CRC correct!
Sending page 31... CRC correct!
Sending page 32... CRC correct!
Sending page 33... CRC correct!
Sending page 34... CRC correct!
Sending page 35... CRC correct!
Sending page 36... CRC correct!
Sending page 37... CRC correct!
Sending page 38... CRC correct!
Sending page 39... CRC correct!
Sending page 40... CRC correct!
Update done!
Re-attempts at UART again doesn't help.

UART must be working in general, when the firmware is running the web interface populates correctly
Screenshot 2022-09-14 at 2.37.10 pm.png
Any one seen this before?
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: UART Firmware updating not working.

Post by Pete9008 »

Seems very odd, does the CRC correct just mean the updater received it correctly or programmed it correctly?

Have you tried a full chip erase on the ST tools? (bit suspicious that lock bits might have got set.)
User avatar
janosch
Posts: 306
Joined: Tue Jun 30, 2020 9:23 am
Location: London, UK
Has thanked: 67 times
Been thanked: 54 times
Contact:

Re: UART Firmware updating not working.

Post by janosch »

Interesting that the upload seems to work, because comms between bootloader and your Python script work and sends the pages through.

1) Could you hook a USB to UART just RX & GND into the connection and listen in to what is being sent when you deploy from STM32Cube, then compare to what is being sent from the Python script?

(Or use a logic analyser if you have one, I just dump everything into a screen terminal tho)

2) Is 2D still being sent once when written from stm32cube? If not, you have overwritten the bootloader

Edit: Ah ok, protocol switch from one method to the other, not a game of spot the difference
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: UART Firmware updating not working.

Post by Bigpie »

Yea, full chip erase works as expected. Reuploading via stm32cube works also, different code can be run etc. Just anything via uart upload. Quite weird.

Stm32cube uses swd not uart, so I'd not see anything on there. Uploading via web interface also has the same issue.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: UART Firmware updating not working.

Post by Pete9008 »

I've had comms lines with a dry joint that managed to couple through parasitic capacitance most of the time, and sort of work, before.

Is it worth checking what Rx and Tx look like on a scope?
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: UART Firmware updating not working.

Post by Bigpie »

Good shout. Will do
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
User avatar
janosch
Posts: 306
Joined: Tue Jun 30, 2020 9:23 am
Location: London, UK
Has thanked: 67 times
Been thanked: 54 times
Contact:

Re: UART Firmware updating not working.

Post by janosch »

If that was the case you would also have problems with web interface and the flashing process, but CRC is transmitted correctly for all pages, which makes this interesting. Maybe try plotting variables through the web interface just to rule it out.
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: UART Firmware updating not working.

Post by Pete9008 »

janosch wrote: Wed Sep 14, 2022 2:18 pm If that was the case you would also have problems with web interface and the flashing process, but CRC is transmitted correctly for all pages, which makes this interesting. Maybe try plotting variables through the web interface just to rule it out.
Agree it's unlikely but I've not got any better ideas :? Also the web interface may be better at coping with dropped messages?

Is the source for updater.py online anywhere? Curious exactly what CRC correct means?
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: UART Firmware updating not working.

Post by Bigpie »

VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: UART Firmware updating not working.

Post by Pete9008 »

Thanks, just had a look, CRC correct means it made it all the way to the bootloader and back without problems - so it looks like janosch is right it's not the serial comms.

The bootloader does not verify the flash write though so it looks like it is the flash write that is failing. What STM32 chip variant is on the board?
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: UART Firmware updating not working.

Post by Bigpie »

UART seems absolutely fine. It's supposed to be STM32F103RBT6, looking at it though, looks suss.
20220914_155511.jpg
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: UART Firmware updating not working.

Post by Pete9008 »

Bigpie wrote: Wed Sep 14, 2022 2:53 pm UART seems absolutely fine. It's supposed to be STM32F103RBT6.
Good news on UART. On the chip I'm wondering whether something else is actually fitted, the ST tool can read the ID and cope but the bootloader doesn't?

Did the ST tool say what it thought the chip was?
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: UART Firmware updating not working.

Post by Bigpie »

Screenshot 2022-09-14 at 4.02.35 pm.png
Not really an expert with these things :D It seems to recognise it properly
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: UART Firmware updating not working.

Post by Pete9008 »

That doesn't look like a real one to me :(

Some of the copies aren't bad, the giga ones in particular are getting reasonable reviews (and are faster than the real ones!).
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: UART Firmware updating not working.

Post by Pete9008 »

Bigpie wrote: Wed Sep 14, 2022 3:04 pm Screenshot 2022-09-14 at 4.02.35 pm.png
Not really an expert with these things :D It seems to recognise it properly
But that claims it's a high density part, I think it should be medium for the RBT6

Edit - it should also be 128k, that's why it doesn't program, different flash block size!

Edit2 - have a look here for details on the clones https://hackaday.com/2020/10/22/stm32-c ... -the-ugly/
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: UART Firmware updating not working.

Post by Bigpie »

Doh, thanks. I'm not up for pulling my board out to see if it identified the same :D
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: UART Firmware updating not working.

Post by Pete9008 »

Fairly sure that's a fake part :(

Not really sure what to suggest, it will probably work fine but then again???

Edit - I suppose it's possible it's a real ST high density part. It's the device marking that doesn't look right though, I've never seen one that looks like that.
User avatar
janosch
Posts: 306
Joined: Tue Jun 30, 2020 9:23 am
Location: London, UK
Has thanked: 67 times
Been thanked: 54 times
Contact:

Re: UART Firmware updating not working.

Post by janosch »

Before you change the chip or the board, have you got a second F103RBT6 that you can flash just to make sure there is nothing else afoot?

Try flashing another chip via UART just to be sure everything else in your process is correct before getting the heat gun out.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: UART Firmware updating not working.

Post by Bigpie »

tested on another board and uart flashing worked

*EDIT* Spoken to Damien, it was high density. Looks like the bootloader maybe doesn't work properly uploading to these.
20220914_190750.jpg
It's now awaiting at new brain.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Post Reply