Skip to content

Increased size of #defined CFG_TUD_CDC_EPSIZE #2770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Increased size of #defined CFG_TUD_CDC_EPSIZE #2770

wants to merge 1 commit into from

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

Increased size of #defined CFG_TUD_CDC_EPSIZE to 128 from tinyusb default of 64.
Reproduced issue 80%+ of the time by running in REPL on CircuitPlayground Express:
>>> raise AttributeError('abcdefghij' * 12)

Note that there is certainly some timing/host driver issue involved, since running the same code when
connected to a Linux instance on the same system never reproduced the code.
I believe the issue is in function tud_cdc_n_write_flush() from lib/tinyusb/src/class/cdc/cdc_device.c:

uint16_t count = tu_fifo_read_n(&_cdcd_itf[itf].tx_ff, p_cdc->epin_buf, CFG_TUD_CDC_EPSIZE);

This limits the count of what is to be flushed to CFG_TUD_CDC_EPSIZE. When a buffer larger than that needs flushing it seems to not flush anything.

Increased size of #defined CFG_TUD_CDC_EPSIZE to 128 from tinyusb default of 64
@tannewt
Copy link
Member

tannewt commented Apr 14, 2020

Thanks for taking a look at this @DavePutz !

I'd rather not change this size. I think it's hiding the issue rather than fixing it.

Our code should be able to chop a larger buffer into multiple tinyusb calls here: https://github.com/adafruit/circuitpython/blob/master/supervisor/shared/serial.c#L60

Maybe TinyUSB is incorrectly reporting a count back?

@tannewt tannewt closed this Apr 14, 2020
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.

2 participants