Wacky idea for USB serial

99 views
Skip to first unread message

Collin Kidder

unread,
Feb 21, 2016, 2:54:36 PM2/21/16
to developers
Currently the USB serial code in the Arduino core uses a 512 byte
buffer in SRAM and requests the USB channel to also use 512 byte
chunks. The SAM3X has 100k of SRAM but 4k of it is not contiguous to
the rest. What if the USB code were expanded to use a 4k buffer (which
it appears the USB spec allows) and that 4k buffer were placed into
the 4k of RAM that normally isn't used for anything?

The reason I want to do this is that I've got sketches that send a
very large amount of data from Arduino to PC and it appears it is
possible for me to fill the 512 byte buffer right up and then even
overflow the buffers feeding it. A 4k buffer would not have this
problem as it would be emptied often enough as the master side (PC)
polls the arduino. So, yeah, my reasoning is for a special case but
that 4k sits idle because it isn't near anything else and so only 4k
of data can be stored there. It seems perfect for this use but I
suppose I can't guarantee that nobody else tried to use the 4k, can I?
Still, if this were documented it would allow for very high transfer
rates from the USB serial interface and would not affect the 99.99% of
people who probably don't even know that the extra 4k of ram exists.

Bill Perry

unread,
Aug 21, 2016, 1:32:15 AM8/21/16
to Developers
If it is possible to overflow an output buffer,  then it sounds like something is seriously wrong in the code or the API is broken as there should be some form of back pressure to prevent this.

Now underflow, that can be a different issue... But even then if the API is properly designed, even this should be a non issue.

--- bill

Reply all
Reply to author
Forward
0 new messages