Menu

#165 STM32F103 Blue Pill with Raspberry Pi 3 Model B

none
Invalid
nobody
None
Medium
Defect
2024-05-11
2024-05-05
No

Hello, I've been going around in circles for the past couple of hours trying to get this to work.

I've enabled serial port, disabled bluetooth, and done a loop test using picocom and a jumper link to confirm the serial port definitely works.

I have wired it correctly, referencing my own knowledge and several guides / other posts on here.

I put the device in boot0 mode too.

picocom does a successful loop test on /dev/serial0 when the link is over the GPIO UART pins, and of course stops when I pull the link.

whenever I run:

sudo stm32flash /dev/serial0

or any combination (and any port)

I always get:

Failed to set terminal flags
Error probing interface "serial_posix"
Cannot handle device "/dev/serial0"
Failed to open port: /dev/serial0

that said if I use rubbish, e.g. /dev/eoviergmio I get the same thing without 'Failed to set terminal flags'

I have tried looking around for references to "Failed to set terminal flags" without any luck.

I would greatly appreciate any insight on this.

Thanks,
Tom

Discussion

  • Thomas Williamson

    a full prompt example with all details:

    pi@test-kit:~ $ sudo stm32flash -v -w blink.bin -b 9600 /dev/serial0
    stm32flash 0.7
    
    http://stm32flash.sourceforge.net/
    
    Using Parser : Raw BINARY
    Size         : 146013
    Failed to set terminal flags
    Error probing interface "serial_posix"
    Cannot handle device "/dev/serial0"
    Failed to open port: /dev/serial0
    
     
    👍
    1
  • Thomas Williamson

    I've just inserted a USB-Serial, and /dev/ttyUSB0 does work when it's inserted - but we really need to use the internal serial.

     
  • Tormod Volden

    Tormod Volden - 2024-05-05

    Are you using the troublesome mini-UART or the other? https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency

    Anyway, a workaround could be to configure the port using stty and then run stm32flash with -b 0.

     
    • Thomas Williamson

      to my understanding I am not using mini-UART. I disabled the bluetooth etc.

      not familier with stty, will have to have a poke.

       
      • Tormod Volden

        Tormod Volden - 2024-05-05

        There is an example in the commit 48231f15 message:

            stty -F /dev/ttyUSB0 raw parenb -parodd -cstopb cs8 115200 time 5 min 0 \
             line 0 -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten \
             -echo -echok -echoctl -echoke
            stm32flash -b 0 /dev/ttyUSB0
        
         
  • Tormod Volden

    Tormod Volden - 2024-05-05

    There is one commit in git that helped for an issue on Raspberry 3 but I am not sure it is the same issue. Worth trying out latest git maybe.

    https://sourceforge.net/p/stm32flash/tickets/146/

     
  • Tormod Volden

    Tormod Volden - 2024-05-05

    if I use rubbish, e.g. /dev/eoviergmio I get the same thing without 'Failed to set terminal flags'

    That is weird, but I cannot reproduce it:

    $ ./stm32flash /dev/eoviergmio 
    stm32flash 0.7
    
    http://stm32flash.sourceforge.net/
    
    Error probing interface "serial_posix"
    Cannot handle device "/dev/eoviergmio"
    Failed to open port: /dev/eoviergmio
    
     
    • Thomas Williamson

      Oh no, that is reproducing it! to clarify I only get 'Failed to set terminal flags' on existing ports.

       
  • Tormod Volden

    Tormod Volden - 2024-05-05

    Disregard that last comment, I read "same thing" but and didn't notice "without".

     
  • Thomas Williamson

    Managed to Resolve it

    For future people having pains, the best config seems to be:

    dtoverlay=miniuart-bt
    enable_uart=1

    and remove the segment from cmdline.txt:

    console=serial0,115200

    used ttyAMA0

    I haven't tried using the gpio control flags as it seems it was depricated from the kernal, written my own using pinctrl for testing.
    gpio7 is boot0
    gpio27 is reset

    pinctrl 17 op dh
    pinctrl 27 op dl
    sleep 0.1
    pinctrl 27 op dh
    sleep 0.2
    sudo stm32flash -b 115200 /dev/ttyAMA0 -v -w generic_boot20_pc13.bin
    sleep 0.5
    pinctrl 17 op dl
    pinctrl 27 op dl
    sleep 0.1
    pinctrl 27 op dh
    
     

    Last edit: Thomas Williamson 2024-05-05
  • Tormod Volden

    Tormod Volden - 2024-05-11
    • status: New --> Invalid
     
  • Tormod Volden

    Tormod Volden - 2024-05-11

    Thanks a lot for reporting back with the solution. I have added it to the Hints section in the wiki.

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB