-
Notifications
You must be signed in to change notification settings - Fork 2.1k
CDC-ACM (serial console) loses characters #12384
Description
Description
I am using newly merged PR #11085 on a SAMR34-Xpro board, with USB support added as per #12135 .
The driver works mostly fine, but after boot some characters are lost. The first few lines of output do arrive perfectly, then there is a gap in trasmission, and then things are smooth again. I've tried adding an fflush() call after each output, but it does not make any difference. Same output under UART works flawlessly.
The same behaviour is exhibited by pyterm, screen, and even cat.
Steps to reproduce the issue
I'm using my SAMR34 branch, but AFAICT any SAM0 based board should exhibit the same behaviour since they share a common USB driver. Possibly the same bug is not even SAM0 specific - can't tell, since I only have this device at hand.
This simple change to tests/usbus_cdc_acm_stdio is enough to trigger the problem:
diff --git a/tests/usbus_cdc_acm_stdio/main.c b/tests/usbus_cdc_acm_stdio/main.c
index e342013af..1b974c4d0 100644
--- a/tests/usbus_cdc_acm_stdio/main.c
+++ b/tests/usbus_cdc_acm_stdio/main.c
@@ -25,6 +25,11 @@
int main(void)
{
(void) puts("RIOT USB CDC ACM shell test");
+ (void) puts("1 RIOT USB CDC ACM shell test");
+ (void) puts("2 RIOT USB CDC ACM shell test");
+ (void) puts("3 RIOT USB CDC ACM shell test");
+ (void) puts("4 RIOT USB CDC ACM shell test");
+ (void) puts("5 RIOT USB CDC ACM shell test");
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
Expected results
All lines in puts() should appear in the output.
Actual results
After the standard RIOT banner, only the first two lines are output. If I type help, the text I get back starts like this:
2 RIhelp
so definitely a good part of the initial output characters has been lost. Subsequent output (with ps or help) seem to be fine.
Versions
Operating System Environment
-----------------------------
Operating System: "Debian GNU/Linux" "10 (buster)"
Kernel: Linux 4.19.0-6-amd64 x86_64 unknown
Installed compiler toolchains
-----------------------------
native gcc: gcc (Debian 8.3.0-6) 8.3.0
arm-none-eabi-gcc: arm-none-eabi-gcc (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
avr-gcc: missing
mips-mti-elf-gcc: missing
msp430-gcc: missing
riscv-none-embed-gcc: missing
xtensa-esp32-elf-gcc: missing
xtensa-lx106-elf-gcc: missing
clang: clang version 7.0.1-8 (tags/RELEASE_701/final)
Installed compiler libs
-----------------------
arm-none-eabi-newlib: "3.1.0"
mips-mti-elf-newlib: missing
riscv-none-embed-newlib: missing
xtensa-esp32-elf-newlib: missing
xtensa-lx106-elf-newlib: missing
avr-libc: missing (missing)
Installed development tools
---------------------------
cmake: cmake version 3.13.4
cppcheck: missing
doxygen: 1.8.13
git: git version 2.20.1
make: GNU Make 4.2.1
openocd: Open On-Chip Debugger 0.10.0
python: Python 2.7.16
python2: Python 2.7.16
python3: Python 3.7.3
flake8: error: /usr/bin/python3: No module named flake8
coccinelle: missing