Arduino Forum

Development => Other Software Development => Topic started by: lfigiel on Jan 17, 2018, 12:03 am

Title: Software serial corrupts data at 115200
Post by: lfigiel on Jan 17, 2018, 12:03 am
According to this (https://www.arduino.cc/en/Reference/SoftwareSerial) software serial supports baudrate up to 115200.

This test (https://github.com/lfigiel/serial_tester) shows that data gets quickly corrupted at 115200 when software serial is used.
Lower baurdates are fine.
Title: Re: Software serial corrupts data at 115200
Post by: pert on Jan 17, 2018, 12:37 am
General community knowledge, including your experience, says that 115200 is not reliable. I think it's generally recommended to use 9600. It's unfortunate the documentation says that. It should probably be corrected.
Title: Re: Software serial corrupts data at 115200
Post by: robtillaart on Jan 17, 2018, 09:51 am
I investigated software serial some eons ago - http://forum.arduino.cc/index.php?topic=138497.0 (http://forum.arduino.cc/index.php?topic=138497.0)

My purpose was to be able to use any baudrate with softwareSerial which worked out pretty well.

What I learned was that it works quite well to 70K (see measurements post #12) .

Note that the test did only serial communication, there was no other code running like that could interfere.
In practice I would say software serial should work reliable up to 38400.

Be aware that receiving with software serial is difficult as one should wait actively for the start bit. If you miss that one communication fails. Effectively softwareSerial receiving is quite blocking.