Menu

#143 error using STM32G491CET6

none
Invalid
nobody
None
Medium
Defect
2022-11-28
2022-03-28
No

I'm trying to use stm32flash from a raspberry to update a stm32g491x MCU via serial but I get this error from the application

pi@raspberrypi:~ $ sudo stm32flash -w OxyMonitor_rev11.hex -b 38400 /dev/ttyAMA0
stm32flash 0.7

http://stm32flash.sourceforge.net/

Using Parser : Intel HEX
Location     : 0x8000000
Size         : 47980
Interface serial_posix: 38400 8E1
GET returns unknown commands (0x 8)
Unknown/unsupported device (Device ID: 0x8079)

Discussion

  • Tormod Volden

    Tormod Volden - 2022-03-28

    Can you please try with a USB-UART dongle, so that we can rule out any issue with the Raspberry serial port?

     
  • Enrico Razzaboni

    Thanks for reply
    this using USB-UART dongle

    pi@raspberrypi:~ $ sudo stm32flash -w OxyMonitor_rev11.hex -b 38400 /dev/ttyUSB1
    stm32flash 0.7
    
    http://stm32flash.sourceforge.net/
    
    Using Parser : Intel HEX
    Location     : 0x8000000
    Size         : 47980
    Interface serial_posix: 38400 8E1
    GET returns unknown commands (0xe3)
    Got byte 0x00 instead of ACK
    
     
  • Tormod Volden

    Tormod Volden - 2022-03-29

    Try -b 115200

     
  • Enrico Razzaboni

    for some reason if i try to use an high baudrate, my mcu doesn't enter in boot mode...
    look at this ( https://community.st.com/s/question/0D53W00001PvxvwSAB/stm32cubeprogrammer-connection-over-uart-error )

    in fact if I set baudrate 38400 I get this error

    pi@raspberrypi:~ $ sudo stm32flash -w OxyMonitor_rev11.hex -b 38400 -c /dev/ttyUSB1
    stm32flash 0.7
    
    http://stm32flash.sourceforge.net/
    
    Using Parser : Intel HEX
    Location     : 0x8000000
    Size         : 47980
    Interface serial_posix: 38400 8E1
    GET returns unknown commands (0x71, 0xe3)
    Got byte 0x00 instead of ACK
    

    and if i try to use 115200 as boudrate i get this,

    pi@raspberrypi:~ $ sudo stm32flash -w OxyMonitor_rev11.hex -b 115200 /dev/ttyUSB1
    stm32flash 0.7
    
    http://stm32flash.sourceforge.net/
    
    Using Parser : Intel HEX
    Location     : 0x8000000
    Size         : 47980
    Interface serial_posix: 115200 8E1
    Failed to init device, timeout.
    
     

    Last edit: Enrico Razzaboni 2022-03-30
  • Tormod Volden

    Tormod Volden - 2022-03-30

    This is from the errata of this chip:

    2.12.2 Data corruption due to noisy receive line
    Description
    In UART mode with oversampling by 8 or 16 and with 1 or 2 stop bits, the received data may be corrupted if a
    glitch to zero shorter than the half-bit occurs on the receive line within the second half of the stop bit.
    Workaround
    None.
    

    I don't know which baud rates lead to 8 or 16. This would affect noisy lines. Is this a custom designed board or a STM dev board?

    Does it work with any other tool for programming over serial? Did you test several chips, or could it be a broken unit?

     
  • Enrico Razzaboni

    I'm using a custom board.
    i can load firmware over serial with Stm32CubeProgrammer. i've tested with more the one micro

     
  • Tormod Volden

    Tormod Volden - 2022-03-30

    Can you please try the patch in https://sourceforge.net/p/stm32flash/tickets/134/#1dd4 which gives more debug information?

    I also remember seeing an issue where one model often would introduce extra zero bytes on the line, but I couldn't find it now. Also there the Cube programmer had a workaround for it.

     
  • Enrico Razzaboni

    pi@raspberrypi:~ $ sudo stm32flash -w OxyMonitor_rev11.hex -b 115200 -c /dev/ttyUSB1
    stm32flash 0.7
    
    http://stm32flash.sourceforge.net/
    
    Using Parser : Intel HEX
    Location     : 0x8000000
    Size         : 47980
    Interface serial_posix: 115200 8E1
    written 2 bytes, starting with 0x01
    read 1 bytes, starting with 0x79
    read 3 bytes, starting with 0x31
    read 1 bytes, starting with 0xf9
    Got byte 0xf9 instead of ACK
    
     
  • Enrico Razzaboni

    Using boudrate 38400 i get this

    pi@raspberrypi:~ $ sudo stm32flash -w OxyMonitor_rev11.hex -b 38400 /dev/ttyUSB1
    stm32flash 0.7
    
    http://stm32flash.sourceforge.net/
    
    Using Parser : Intel HEX
    Location     : 0x8000000
    Size         : 47980
    Interface serial_posix: 38400 8E1
    written 1 bytes, starting with 0x7f
    read 1 bytes, starting with 0x79
    written 2 bytes, starting with 0x01
    read 1 bytes, starting with 0x79
    read 3 bytes, starting with 0x31
    read 2 bytes, starting with 0x00
    read 1 bytes, starting with 0x79
    written 2 bytes, starting with 0x00
    read 1 bytes, starting with 0x79
    read 1 bytes, starting with 0x0b
    read 12 bytes, starting with 0x71
    read 11 bytes, starting with 0x00
    read 8 bytes, starting with 0x00
    read 4 bytes, starting with 0xe3
    read 3 bytes, starting with 0x00
    GET returns unknown commands (0xe3)
    read 1 bytes, starting with 0x00
    Got byte 0x00 instead of ACK
    
     
  • Enrico Razzaboni

    i've tried with a lower baudrate and it works... at this point i think is my harware issue.
    thank you for the help

     
  • Tormod Volden

    Tormod Volden - 2022-03-31

    Did the Stm32CubeProgrammer also use a very low baud rate?

    You can use SWD to program a test program onto it, e.g. a test program that simply sets up the serial port and echoes RX back to TX. Then you can check if the serial line is reliable.

     
  • Tormod Volden

    Tormod Volden - 2022-03-31

    And if you have an oscilloscope, check the waveforms and noise level. And sometimes the RX and TX connections are good but the ground connection has been left out...

     
  • Anonymous

    Anonymous - 2022-04-01

    i've checked and on micro side, in Tx line there is a lot of noise.
    this should be caused by a hardware peculiarity, on the same serial i can communicate with two micro

     
  • Tormod Volden

    Tormod Volden - 2022-11-28
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
     I'm trying to use stm32flash from a raspberry to update a stm32g491x MCU via serial but I get this error from the application
     ~~~
     pi@raspberrypi:~ $ sudo stm32flash -w OxyMonitor_rev11.hex -b 38400 /dev/ttyAMA0
    
    • status: New --> Invalid
     
  • Tormod Volden

    Tormod Volden - 2022-11-28

    Thanks for following up. Closing this then.

     

Anonymous
Anonymous

Add attachments
Cancel