USB-CDC pseudo serial communication
Posted: Sat Feb 06, 2021 8:08 pm
Hi all,
I am starting a project where I need to transfer CAN frames across a USB-CDC connection between a STM32 Duino card and a tablet running a custom Program.
My concerns are:
1- is the CDC link reliable, i.e. do I need to add a checksum or CRC checking, or can I rely on the CDC's inherent integrity?
2- When the STM32 Duino program performs a print of a string to a CDC serial port, is the string transferred in a single transaction? Or is it broken in chunks?
3- CAN frames allow for the data field any value. Thus I cannot send the raw data field, for I need to delimit the frame and I cannot rely on CRLF to do so. Is there a way to know that a packet is received, and to read it back as a block, so that the position of the bytes in the block can be trusted to interpret the frame?
If there is no way to delimit the packet, I do not see any other way than send the data as a string of hexadecimal numbers terminated by a CRLF, but this consumes twice as much time and memory.
I am starting a project where I need to transfer CAN frames across a USB-CDC connection between a STM32 Duino card and a tablet running a custom Program.
My concerns are:
1- is the CDC link reliable, i.e. do I need to add a checksum or CRC checking, or can I rely on the CDC's inherent integrity?
2- When the STM32 Duino program performs a print of a string to a CDC serial port, is the string transferred in a single transaction? Or is it broken in chunks?
3- CAN frames allow for the data field any value. Thus I cannot send the raw data field, for I need to delimit the frame and I cannot rely on CRLF to do so. Is there a way to know that a packet is received, and to read it back as a block, so that the position of the bytes in the block can be trusted to interpret the frame?
If there is no way to delimit the packet, I do not see any other way than send the data as a string of hexadecimal numbers terminated by a CRLF, but this consumes twice as much time and memory.