Skip to content
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

fast serialUSB read function readBlock #4871

Closed
wants to merge 6 commits into from

Conversation

sined23
Copy link

@sined23 sined23 commented Apr 15, 2016

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

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);

after that read speed is incredible increases !!! Up to 12Mbit/s

buffer->head = i;

i = (i + 1) % CDC_SERIAL_BUFFER_SIZE;
uint8_t c[CDC_SERIAL_BUFFER_SIZE];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are overwriting the c variable above. Remove it or rename the array.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted c variable. thanks

@sandeepmistry sandeepmistry added Architecture: SAM Applies only to the SAM microcontrollers (Due) USB: CDC serial Serial interface used by MCUs with native USB (e.g. Leonardo) to communicate with the computer labels Jul 19, 2016
@facchinm
Copy link
Member

Moved to arduino/ArduinoCore-sam#3

@facchinm facchinm closed this Jan 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture: SAM Applies only to the SAM microcontrollers (Due) USB: CDC serial Serial interface used by MCUs with native USB (e.g. Leonardo) to communicate with the computer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants