kevinmehall / usb

Minimalist portable USB device stack for SAMD21, LPC1800, LPC4300, Xmega
MIT License
100 stars 20 forks source link

USB CDC: first character NUL? #10

Closed andyboeh closed 7 years ago

andyboeh commented 7 years ago

I just tried your USB library on a SAM D21 and it allowed me to implement USB-Serial very quickly (based also on Tessel 2 Firmware) - thank you very much!

I'm using a terminal emulator (Putty and screen tested) on my host to connect to the device. The device echoes my output to the UART. However, the first character sent from the host to the device reads as NUL. Afterwards, it seems to work fine. The other way round, it takes several seconds (!) for the terminal to receive the first characters from the device.

Any idea why this happens?

Thanks!

andyboeh commented 7 years ago

I fixed it myself. I added support for line encoding and was missing a) an usb_ep0_in(0) after receiving the request and b) another usb_ep_start_out(USB_EP_CDC_OUT, ...) after receiving the answer.