mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-29 03:46:33 +00:00
Problem: cdc_acm sample outputs junk characters to the console when any key is pressed. It is supposed to echo the same character as the input. Analysis: nRF52840 USB driver always reads 64 bytes from the USB peripheral's local buffer irrespective of the data length. Even when 1 byte is sent by the host, the usb driver receives as 64 bytes. Since the maximum packet size value had been used when setting up the EasyDMA's MAXCNT register for OUT transactions, DMA transffered the entire 64 bytes of it's local buffer into the data RAM irrespective of the OUT data length, containing garbage at the end of useful payload. For some applications like hci_usb the extra bytes were being ignored. But for cdc_acm, the entire 64 bytes is getting echoed back displaying garbled characters on the terminal. Fix: For OUT endpoints, the amount of data received by USBD to its local buffer should be read using SIZE.EPOUT[x] registers in the case of BULK and INTERRUPT endpoints and SIZE.ISOOUT register for ISOOUT endpoint. This value should be set to the EasyDMA maxcnt register to DMA into RAM buffer. Fix this issue for Bulk, Interrupt and ISOOUT endpoints. Signed-off-by: Sundar Subramaniyan <sundar.subramaniyan@gmail.com> |
||
---|---|---|
.. | ||
device | ||
CMakeLists.txt | ||
Kconfig |