Skip to content

Conversation

@DavePutz
Copy link
Collaborator

@DavePutz DavePutz commented Apr 14, 2020

Issue #1639 Application exception output to serial (over USB) appears truncated due to buffering issue

Added code in serial_write_substring() to split large writes into chunks to help avoid buffer overflows.
A limit of CFG_TUD_CDC_EPSIZE was used, since that is the limit used in tud_cdc_n_write_flush() from lib/tinyusb/src/class/cdc/cdc_device.c.
Prior to the fix there was a reproduction of the issue about 80% of the time using
>>> raise AttributeError('abcdefghij' * 12)
After the fix 50 cycles were run with no truncated outputs.

Added code in serial_write_substring to split large writes into chunks to help avoid buffer overflows.
@tannewt
Copy link
Member

tannewt commented Apr 14, 2020

I thought TinyUSB did this already. @hathach can you take a look at this?

@hathach hathach closed this Apr 15, 2020
@hathach
Copy link
Member

hathach commented Apr 15, 2020

@DavePutz could you please tell me how to reproduce the issue, also on which board as well. I will try to see if there is a bug within tinyusb stack.

@DavePutz
Copy link
Collaborator Author

DavePutz commented Apr 15, 2020 via email

@hathach
Copy link
Member

hathach commented Apr 15, 2020

Ok, so it is windows only issue. It sounds like this tinyusb issue. There is a pending PR in the stack repo hathach/tinyusb#260

I will try to reproduce first then get back to you. One last question, does this happen to the latest CPY version 5.2 right ?

@DavePutz
Copy link
Collaborator Author

DavePutz commented Apr 15, 2020 via email

@hathach
Copy link
Member

hathach commented Apr 15, 2020

Hi, Yes, this reproduces on CPY 5.2. Also, I rewrote to use tud_cdc_write_available() but that still fails in the same way. -Dave

Thanks, I will try to reproduce it tomorrow to see if it is usb stack bug :)

@hathach
Copy link
Member

hathach commented Apr 16, 2020

@DavePutz I could reproduce it on my local machine. Will try to troubleshoot it. We will move back to the #1639 for discussion since this PR is already closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants