USB CDC - Packets are lost on macOS
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?