Issues with RP2040 USB Serial

Hello,
I'm developing a simple proof of concept device to allow a PC to control some lights and displays. I have chosen the Arduino Nano RP2040 to run the lights and displays and then communicate with the PC using a USB to serial connection. Everything works great, but I can break the serial communication if I absolutely hammer the com port with messages. When this happens, the Arduino becomes unresponsive and requires a reboot. Accordingly, I assumed this was simply a buffer overrun. I have changed my code to make sure all characters are out of the serial buffer before calling other routines to alleviate this:

  while(Serial.available()>0)
  {
    newMsg = Serial.readStringUntil('|');
    msgBuffer.push(newMsg);
  }

Despite this change, I can still break the Arduino if I beat on it mercilessly. I've even tried clearing out all of my logic and simply making a sketch that empties the serial buffer (like above) and simply echos back what was received, but I still have the same issue. Is there something I am missing or is this a limitation of the USB serial and I simply need to move to one of the hardware UARTs?

Welcome to the forum.

Did you try to use Serial.read()?

How do you do that? I guess you cannot type that fast?

I doubt the hardware UART is going to be as fast as USB Serial.

Maybe the USB is too fast and you need to increase the buffer for Serial.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.