Serial Communication with Software Serial

I am working on arduino UNO with bi-directional communication with a raspberry pi and I was attempting to read a string from the Rpi instead of the normal single characters that I usually do (with success) .
When I attempted to read a string from the RPi I noticed that I could not read the full string . If I sent the string (from the console) “c1234567” my Uno would only get “c127”. This behavior was consistent with all serial communication methods it doesnt matter if I used or Serial.readString the result would be the same. Meaning I could only get the first 3 characters of the string plus the last one when ever I would send the Uno a “String” (individual chars worked perfectly)

I worked all day on this and realized that since I am also using SoftwareSerial that the combination of these two has cause problems in the past so when I removed the lines of code dealing with SoftwareSerial the regular serial input is now getting the whole string “c1234567”
What could be going on ?
I’m using arduino 1.01 on raspbian and I have tried NewSoftSerialc10 (it did not work at all) Windows does not have this issue but, Im running 1.67 there.

Here is the code snippet that works on windows(1.67) but not in raspbian(1.01):

#include <SoftwareSerial.h>
#include <SabertoothSimplified.h>

SoftwareSerial SWSerial(NOT_A_PIN, 4);
SabertoothSimplified ST(SWSerial); //open a serial COM on previously identified pin

while (Serial.available())
val1 = Serial.readString();

if (val1[0]==‘c’)
Serial.println(“Command mode:”);
Serial.print(“string input :”);


What could be causing this odd behavior ? I keep reading that all previous issues with softwareserial conflicts were solved in 1.0 so I really shouldn’t have to add “NewSoftSerial” third party lib… correct ?

If I understand you correctly, you develop Arduino software on both Windows and Raspberry. Compiled on Windows and uploaded to the Uno it behaves as you think it should behave; compiled on Raspberry and uploaded to the Uno it does not behave as you think it should behave.

Can you post a full example code that exhibits the behaviour? At this stage I only see that you are sharing the the RX pin of the hardware serial with the RX pin of software serial; I somehow doubt that that is a good idea. And next you use hardware serial to read?

I might be missing something obvious ??

Note: NOT_A_PIN is defined as 0 (I'm using IDE 1.6.6, file Arduino.h). Its purpose isn't to indicate pin 0, so I advise not use it for that. If you want to use pin 0 in software serial, simply put 0 in the declaration. In the future the Arduino people might decide to use 0xFF for it and your code no longer works.

//PS I don't have a Raspberry so can't test.

Have a look at the examples in Serial Input Basics


I solved the issue by going back to 9600 baud from 57600. I do remember someone saying that the Uno had issues at higher speeds.

Thanks for your responses !

buckstucky: I solved the issue by going back to 9600 baud from 57600. I do remember someone saying that the Uno had issues at higher speeds.

It's not the Uno that has speed problems, it is SoftwareSerial.