cancel
Showing results for 
Search instead for 
Did you mean: 

USB CDC - Packets are lost on macOS

pierpaolo
Associate II

I'm using the P-NUCLEO-WB55 development board, with only USB (CDC Device) enabled/configured through the STM32CubeIDE.

I'm sending data from my laptop to the board over USB CDC (Virtual Com Port) in Full-Speed mode.

Specifically, my laptop is sending 1041 bytes, and I'm using the following (simple) Python script (it depends on pyserial):

import serial
 
s = serial.Serial('/dev/cu.usbmodem206F389630361 or COM3 or /dev/ttyACM0')
 
msg = bytearray(1041)
for i in range(0, len(msg)):
    msg[i] = 0xA5
 
print(s.write(msg))

When I run this script on Linux or Windows 10, everything works fine, i.e. the board receives the 1041 bytes sent by the laptop.

However, when I run this script on macOS, a lot of packets are lost. I'm not sure which ones specifically, but the board receives between 400 and 900 bytes instead of 1041.

Is it a macOS USB driver problem?

Any tips?

2 REPLIES 2

> Is it a macOS USB driver problem?

Observing the traffic on the USB bus using an USB analyzer or a USB-decoding capable LA or oscilloscope, would reveal the truth quickly...

JW

AD.1
Associate

Bumping this, as it still an issue on MacOS not being able to send UART bytes to the microcontroller via the ST-LINK. If anyone has further information please share. This is very annoying.