(Solved) Can't transfer specific byte sequence over VCP
So far I have been using VCP in my project for about six months with no problems. But today I found it was not able to send a specific 'packet' of bytes.
Here is the SWV printf output from STM32CubeIDE:
Sending 10 bytes
255
254
5
0
19
0
0
0
24
106
Note the 19, which is the actual main content of the message. The first two bytes are a message header, last two bytes are a checksum.
Now here's what I receive on the computer (Fedora Linux, libserialport)
Read 9 bytes
255
254
5
0
0
0
0
24
106
The 19 is missing. If I change it to 18 or 20 there is no problem, and I cannot find any other numbers which cause a problem, only 19. This is 100% repeatable, not an occasional problem.
I am sending using CDC_Transmit_FS which returns 0 (USBD_OK).
On the computer I'm using sp_nonblocking_read, which returns 9.
Docs for the libserialport function:
https://www.sigrok.org/api/libserialport/0.1.0/a00008.html#gad7fdeeacdef532f44185cc68e166d46b
Any tips for how to investigate this further? If it was a regular serial connection I could use my logic analyzer to look at the tx/rx wires directly, but is that possible with VCP?
