Data loss when sending to native USB port (SerialUSB)

From what i understand, this Read code:

int Serial_::read(void)
{
	LockEP lock(CDC_RX);
  	USB_LED_UPDATE;
	if(peeked){
		peeked=0;
		return peeked_u8;	  
	}
	if (!UDD_FifoByteCount(CDC_RX))
		return -1;
	
	uint8_t c = UDD_Recv8(CDC_RX);
	if (!UDD_FifoByteCount(CDC_RX)){
		UDD_ReleaseRX(CDC_RX);
	}
	return c;
}

In here:
uint8_t c = UDD_Recv8(CDC_RX);
do you receive just 1 byte with UDD_Recv8?
Then if you releaseRX, doesnt it drops all the data stored? if so, we readed one byte and then dropped all the rest, it is consistent with the 512b im getting, since the packets seem to be coming in by 512 im only getting the 1st byte and then dropping everything till the next packet.

I managed to modify the library and by not using a ring buffer (i still use a buffer tho, using memcpy) i managed to achieve 220kbps instead of the 110kbps, but this is far far away from your tests so it would be good if we can get the 1-byte read working :slight_smile:

You can try my code, it makes the bug instant, i can compile the app and post it if u dont have VB