Relative Content

Tag Archive for python-3.xserial-portstm32pyserialteensy

PySerial write not respecting baudrate on Mac and Linux (but it does on Windows)

I’m attempting to write a byte stream to a serial device using PySerial in order to upload a file. The device manufacturer recently switched from a Teensy-based board to a STM32-based one. The code below works fine on the Teensy-based board, regardless of OS. With the STM32 board, however, the code works fine in Windows, but in MacOS and Linux, the data writes too fast. Rather than restricting itself to the defined baud rate, it just writes as fast as it can read. This results in the device not receiving the data and timing out the write operation.