zephyr: Console showing frequent usb warnings: usb_device: Failed to write endpoint buffer 0x82
Describe the bug Build the blinky application with usb console and shell. When there is shell activity, there are frequent console warnings:
[00:09:21.039,276] <wrn> usb_device: Failed to write endpoint buffer 0x82
I have also noticed occasional dropped characters in the output stream.
To Reproduce Steps to reproduce the behavior:
- west build -p auto -b adafruit_feather_m0_basic_proto
- boot board and connect terminal (I am using screen -L /dev/cu.usbmodem0_011)
- type “help” several times
The actual board is not the Adafruit board but my own custom board. I used the Adafruit board settings for my board.
Expected behavior No warnings.
Impact The console message is an annoyance. The dropped characters are a concern.
Screenshots or console output Here is a sample output of the warning message:
uart:~$ help
Please press the <Tab> button to see all available commands.
You can also use the <Tab> button to prompt or auto-complete all commands or its subcommands.
You can try to call commands with <-h> or <--help> parameter for more information.
Shell supports following meta-keys:
Ctrl+a, Ctrl+b, Ctrl+c, Ctrl+d, Ctrl+e, Ctrl+f, Ctrl+k, Ctrl+l, Ctrl+n, Ctrl+p, Ctrl+u, Ctrl+w
Alt+b, Alt+f.
Please refer to shell documentation for more details.
[00:09:21.039,276] <wrn> usb_device: Failed to write endpoint buffer 0x82
[00:09:21.039,672] <wrn> usb_device: Failed to write endpoint buffer 0x82
[00:09:22.018,493] <wrn> usb_device: Failed to write endpoint buffer 0x82
[00:09:22.026,367] <wrn> usb_device: Failed to write endpoint buffer 0x82
[00:09:22.026,580] <wrn> usb_device: Failed to write endpoint buffer 0x82
[00:09:22.027,313] <wrn> usb_device: Failed to write endpoint buffer 0x82
[00:09:22.027,526] <wrn> usb_device: Failed to write endpoint buffer 0x82
[00:09:22.999,572] <wrn> usb_device: Failed to write endpoint buffer 0x82
[00:09:22.999,969] <wrn> usb_device: Failed to write endpoint buffer 0x82
I also noticed in an earlier build of my blinky app that the output would occasionally drop characters. Here is a sample from that output (I added line to print the loop cnt value):
920Message 921Message 922Message 923Message 924Message 925Message 926Message 927Message 928Message 929Message 930Message 931Message 932Message 933Message 934M1791Mesage 1792Message 1793Message 1794Message 1795Message 1796Message 1797Message 1798Message 1799Message 1800Message 1801Message 1802Message 1803Message 1804Message 1805Message 1806Message 1807Mesage 1808Message 1809Message 1810Message 1811Message 181Message 1813Message 1814Message 1815Messae 1816Message 1817Message 1818Message 1819Message1820Message 1821Message 1822Message 1823Message 1824Message 1825Message
If you look closely at the output, you will see it occasionally drops a character.
Environment (please complete the following information):
- build using macOS
- toolchain is gnuarmemb
- Zephyr version 2.1.0-rc1 VERSION_MAJOR = 2 VERSION_MINOR = 1 PATCHLEVEL = 0 VERSION_TWEAK = 0 EXTRAVERSION = rc1
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 27 (14 by maintainers)
Hi folks. FYI, I’m working on on the SAM0 driver and will get it to pass testusb.
re: the driver returning
-EAGAIN, the dw, stm32, nrfx, and sam0 drivers all use this as ‘a transfer is currently going on, please try again’.usb_writeand the log message seem to be incorrect, as the API doesn’t require the call to block if there’s an ongoing transmission - instead the caller is supposed to wait for the callback.@jfischer-phytec-iot @nzmichaelh @KubaFYI I believe the wait on the BK1RDY flag I demonstrated above ensures the hardware buffer is ready before it gets overwritten.
In my case, I never encounter the failed to write endpoint buffer error since making this change.