USB CDC data loss
Hello,
I am trying to transmit some data on my STM32F042F6P6. But my PC's serial monitor only picks up some of it. Here is the code and the serial monitor output:
void readAllRegs(void){
uint8_t value;
for (uint8_t addr = 0x00; addr <= 0x2E; addr++) {
value = readReg(addr);
printf("0x%x: 0x%x (%d) \n", addr, value, value);
fflush(stdout);
}
}
int _write(int file, char *ptr, int len){
CDC_Transmit_FS((uint8_t *)ptr, len);
return len;
}0x0: 0x29 (41)
0x1: 0x2e (46)
0x4: 0xd3 (211)
0x6: 0xff (255)
0x7: 0x4 (4)
0xa: 0x0 (0)
0xd: 0x1e (30)
0x10: 0x8c (140)
0x13: 0x22 (34)
0x14: 0xf8 (248)
0x16: 0x7 (7)
0x19: 0x76 (118)
0x1a: 0x6c (108)
0x1d: 0x91 (145)
0x1f: 0x6b (107)
0x20: 0xf8 (248)
0x23: 0xa9 (169)
0x25: 0x20 (32)
0x26: 0xd (13)
0x29: 0x59 (89)
0x2c: 0x88 (136)
When I change the Tx buffer size from 128 bytes to 512 bytes, there is even more data loss:
0090
5f040x00 f80230x07406 :(
:(0210002(001xb
Can someone explain to me what is happening here? I thought CDC was reliable
Thank you
