WHICH Software Serial To Use?

I finally have a use for SoftwareSerial! There are numerous different ones out there. Which is the best one to use, and why? This will sound crazy, but, ideally, I'd like to use the Serial2 pins on a Mega2560 for the SoftwareSerial. I don't absolutely require the Arduino to receive from the Software Serial, but do need it to transmit.

Regards,
Ray L.

Okay, I will bite. Why would you want to use software serial when you have hardware serial available to you?

Your answer may be part of determining which software serial implementation is "best".

I found the "Serial Port Options" section of:
https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html
to be pretty helpful.

Search for posts by -dev (formerly /dev). He/she wrote one of the alternatives and often posts in software serial related questions. I've seen posts where the differences were explained.

Here's a good SE answer from -dev on this topic:

pert:
Here's a good SE answer from -dev on this topic:
What's the difference between all the Software Serial Libraries? Which one is Arduino Nano compatible? - Arduino Stack Exchange

My lazyness earned you a karma :slight_smile:

pert:
Here's a good SE answer from -dev on this topic:
What's the difference between all the Software Serial Libraries? Which one is Arduino Nano compatible? - Arduino Stack Exchange

That really helped a lot. Thanks! My only choice is his NeoSWSerial!
Regards,
Ray L.

This will sound crazy, but, ideally, I'd like to use the Serial2 pins on a Mega2560 for the SoftwareSerial.

It does sound crazy and I would be interested in your reasons. Is it perhaps because you want the program to also work on boards with only 1 hardware Serial ?

RayLivingston:
ideally, I'd like to use the Serial2 pins on a Mega2560 for the SoftwareSerial.

A dead certain fatal mistake........

Further, unless you have more than four serial devices you want to connect to, using software serial on a Mega is just madness, and something you definitely don't want to write home to your mother about. Indeed, if you do want to communicate with more than four serial devices, you might be better off with something other than an Arduino.

UKHeliBob:
It does sound crazy and I would be interested in your reasons. Is it perhaps because you want the program to also work on boards with only 1 hardware Serial ?

That is exactly it. My development system currently uses Megas, but the real hardware will use ProMinis. The Megas are already wired for the "debug" port on Serial2, and I don't want to have to modify the wiring to use SoftwareSerial instead, so I can test the full, final firmware.
Regards,
Ray L.

It doesn't matter what your intentions are, using software serial on Serial2 is not a good idea.

Nick_Pyner:
It doesn't matter what your intentions are, using software serial on Serial2 is not a good idea.

Because? The Serial2 pins are GPIOs, exactly like every other GPIO. What makes using them "not a good idea"?
Regards,
Ray L.

Software serial uses additional memory, reduces throughput, and has limitations (depending upon what type of software serial is used) compared to using hardware serial. Usually, if there is hardware serial available, hardware serial should be used. However, I think that the reason in reply #9 from RayLivingston is sufficient for this particular and special case.

If there is some other reason, then I hope someone will provide it.

Their very name should give you all the caution you need, particularly in the light of a swag of other pins being available. The serial2 pins are hardware serial pins and therefore cleearly not GPIO pins exactly like any other GPIO. There are other, less obvious, restrictions on the use of pins as well, and I believe they vary with the different libraries. I guess this would be itemised in the libraries and Mega data sheets.

All you posters going on about using software serial seem to be missing the point that the code will be transitioning to a Promini. Any 2 pins will work fine for that on a Promini/'328P as all pins support PCINT.

I think you're missing the point that, right now, OP is actually using a Mega, and there have been plenty of occasions around here where people have had grief using software serial on Mega's hardware serial ports - surely enough to make it look like a particularly dumb idea. Further, while I have no idea what PCINT is, it is pretty clear that not all pins on anything necessarily support software serial. I assume this is a matter of the software more than whether the pins support PCINT or not, and I believe that support varies between libraries. I guess the peeping monkey will eventually reveal all..........

I guess the peeping monkey will eventually reveal all..........

ALL.

Yes, it's about time you showed up..........

Sorry, link fixed above.

Yes, it's about time you showed up..........

I really didn't have anything to add, except the link to the Arduino source code.

It does seem silly to even think of using a software serial library on a hardware serial port. The comments in the referenced code explain why, and also list which pins are supported on the Mega. You can't use SoftwareSerial or NeoSWSerial on the Serial2 pins.

Personally, I would just use #if statements to build differently on the two platforms. I do understand the desire to test the software serial build on the Mega, though. It would require different pins, something the OP did not want to change.

Paint. Corner. Can't help.