ArduinoCore-sam icon indicating copy to clipboard operation
ArduinoCore-sam copied to clipboard

fast serialUSB read

Open sined23 opened this issue 9 years ago • 10 comments

Hi guys! I increased serialUSB read speed from 1Mbit/s up to 12Mbit/s. Details are here http://forum.arduino.cc/index.php?topic=391757.0 I suggest you to take it for new arduino version.

sined23 avatar Apr 15 '16 08:04 sined23

Hi @sined23 , would you mind opening a proper PR ? So we can review easily :smile:

facchinm avatar Apr 15 '16 08:04 facchinm

Sorry, I don't know how to do it. You can review these new libraries and compare with existing http://forum.arduino.cc/index.php?action=dlattach;topic=391757.0;attach=163027

sined23 avatar Apr 15 '16 08:04 sined23

if you have questions for changes pls ask

sined23 avatar Apr 15 '16 08:04 sined23

The main idea is that bytes are written and read into/from CDC buffer not one by one but block of bytes

sined23 avatar Apr 15 '16 08:04 sined23

Serial_::accept write into CDC buffer as maximum as possible (only to not overflow the buffer) Serial_::readb (you can change just read, not use readb) get from CDC buffer as maximum as possible or nessasary length

and one more important thing: in USBD_Recv "while (n--) *dst++ = UDD_Recv8(ep & 0xF);" should be replaced into UDD_Recv(ep & 0xF, dst, len);

sined23 avatar Apr 15 '16 08:04 sined23

after that read speed is incredible increases !!!

sined23 avatar Apr 15 '16 08:04 sined23

Fork the repo, do the changes, upload and open a pr. Its very simple, just learn some basic git commands (clone, add, commit, push).

NicoHood avatar Apr 15 '16 09:04 NicoHood

created PR

sined23 avatar Apr 15 '16 19:04 sined23

Hi guys! Do you plan to merge this PR? https://github.com/arduino/Arduino/pull/4871

sined23 avatar May 16 '16 20:05 sined23

merged?

iddq avatar Jan 28 '20 12:01 iddq