USB CDC speed and truncated binary data
Posted: Fri Jun 08, 2012 2:03 pm
I'm testing the USB serial driver on the STM32F103, which now works fine (after noticing that there is no internal pullup like on the STM32F4). However, I have some issues:
When sending binary data it gets corrupted in some strange way, some byte values are never received, some sometimes.
The uC does nothing but sending bytes 0x00 to 0xff repeatedly. Now when I make a histogram of the received bytes it looks like this:

So bytes 3, 17, 19, 26 and 28 are never received, and other bytes depending on the order.
When sending the bytes in descending order it gives similar results:

Does anyone know what could be the problem? Are some bytes used as control characters or so?
When I'm just sending values from 32 till 127 everything is fine.
Also the speed is quite low, the maximum speed I could get is 85kByte/s, while it should be possible to reach more than 1MByte/s. Is this a limitation of the implementation in ChibiOS?
This is the sending code:
I measure the speed with:
This gives 85kByte/s when just sending bytes from 32 till 127.
Thanks,
When sending binary data it gets corrupted in some strange way, some byte values are never received, some sometimes.
The uC does nothing but sending bytes 0x00 to 0xff repeatedly. Now when I make a histogram of the received bytes it looks like this:

So bytes 3, 17, 19, 26 and 28 are never received, and other bytes depending on the order.
When sending the bytes in descending order it gives similar results:

Does anyone know what could be the problem? Are some bytes used as control characters or so?
When I'm just sending values from 32 till 127 everything is fine.
Also the speed is quite low, the maximum speed I could get is 85kByte/s, while it should be possible to reach more than 1MByte/s. Is this a limitation of the implementation in ChibiOS?
This is the sending code:
Code: Select all
while (TRUE) {
for (n=0; n<256; n++) {
chSequentialStreamWrite((BaseSequentialStream *)&SDU1, &n, 1);
}
}
I measure the speed with:
Code: Select all
dd if=/dev/ttyACM0 of=rx &pid=$!; sleep 10; kill -USR1 $pid; sleep 1; kill $pidThis gives 85kByte/s when just sending bytes from 32 till 127.
Thanks,