Serial buffer size for Arduino Due

Hello everyone!

I have a problem with the Serial connection between Nvidia TX2 and Arduino Due and have the following error:

Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

After reading some suggestions on different forums I decided that my problem is with the buffer size of the Serial on Arduino and I want to change it.
But it is different for different versions of Arduino IDE. My current one is 1.8.19 and I was looking for the following file to change the buffer size: hardwareserial.h
like in this topic: link to similar topic

I have found this file in the current directory:
/usr/share/arduino/hardware/arduino/cores/arduino:

The current OS is Ubuntu 18.04

But HardwareSerial.h doesn't contain anything like:
#define SERIAL_TX_BUFFER_SIZE 64
#define SERIAL_RX_BUFFER_SIZE 512

Maybe it was like that in previous IDE versions.

The closest thing I've found was in HardwareSerial.cpp file

I've commented the line "#define SERIAL_BUFFER_SIZE 64"
and added the line "#define SERIAL_BUFFER_SIZE 512"

And uploaded my code to Arduino Due, but it didn't do any changes and I got the same error.
It may be something else but I am sure that I made changes in the wrong place.

In other topics, I saw people point to the library RingBuffer but I can't find this library in my Arduino folder.

The question is how to change the buffer size for Serial messages in my configuration:
Arduino Due
Arduino IDE 1.8.19
OS: Ubuntu 18.04

Thank you in advance!

Did you close the IDE and re-open?

Is the correct port selected in the IDE (Native or Programming)? I have found this page to be useful in the past.

https://www.arduino.cc/en/Guide/ArduinoDue

This part is how I forced my IDE/PC to "see" the Due again before. It's been a while though but I feel your pain.

The SAM3X microcontroller differs from AVR microcontrollers because the flash memory needs to be erased before being re-programmed.

Also, do you have that
while (!Serial);
line in your setup?

Note that you'll need to change the Serial files used for Due, which are NOT in usr/share/arduino.hardware, but rather someplace like:
~/Arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino/RingBuffer.h

1 Like

Thank you! That is what I was looking for.. couldn't find the right folder at first, because it is not "arduino15" but ".arduino15" (with period at the beginning) in my case and it is hidden folder.

So, just in case it will be helpful for someone else, in my case the whole path to the RingBuffer.h file is:
/home/myusername/.arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino

And here I was able to find RingBuffer.h file.

Inside the file, there is a line: #define SERIAL_BUFFER_SIZE 128

which I tried to change to 256 and 512 value.

Unfortunately, it didn't solve the original problem, I still have an error:

Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

But, thank you! Your hint is what I was asking.

1 Like

Great. Sorry about the missing "."; the windows filename is different and doesn't have a dot. (and also hidden and difficult to find since not included in "search".)

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