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

CDC boolean operator speed issue #106

Open
DesperateProgrammer opened this issue Jun 9, 2020 · 0 comments
Open

CDC boolean operator speed issue #106

DesperateProgrammer opened this issue Jun 9, 2020 · 0 comments

Comments

@DesperateProgrammer
Copy link

While looking for a slow USB CDC connection (~30-40kB/s) I found that there is an artifical delay in the boolean operator:

I can not find a reasoning for this delay. Removing it from the source greatly improved USB Speed for me to about 140kB/s

void setup() {
  // put your setup code here, to run once:
  SerialUSB.begin(2000000) ;
}

byte buffer[512] ;

void loop() {

#if 1
  int pos = 0 ;
  if (!SerialUSB)
    return ;
  while (SerialUSB.available())
  {
    if (pos >= sizeof(buffer))
      return ;
    buffer[pos++] = SerialUSB.read();
  }
  if (pos)
    SerialUSB.write(buffer, pos);
  return ;
#endif
}

Does anyone know the reasoning behind this delay?

Thanks in advance,
Tim

DesperateProgrammer pushed a commit to DesperateProgrammer/ArduinoCore-sam that referenced this issue Jun 10, 2020
Removed delay in CDC Driver to check for connected state in Serial_::operator bool()
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

No branches or pull requests

1 participant