Software Serial on Mega2560

Hi

I'm using a Mega2560 (with 4 Hardware UART's) but need an extra

Serial (USB) er used for programming / debug Serial1 used for GPS, only RX @ 4800, 9600 or 19200 Serial2 used for On Screen Display, only TX @ 115200 (could be as low as 19200) Serial3 used for comm with another Arduino, RX and TX @ 1200, 2400, or 4800 (very long cable)

But I do need another UART for a USB FLASH drive (USB Host from Hobbytronics.co.uk)

All Serial ports need buffer of minimum 128 bytes (I do have RAM enough)

Which function should I move to Software Serial? (In order to save on CPU power)

Regards Hans

Use an USB host adapter that is connected by SPI instead of a UART interface.

Theoretically the GPS and the On Screen Display could be on the same serial interface.

DeepLink: Serial (USB) er used for programming / debug Serial1 used for GPS, only RX @ 4800, 9600 or 19200 Serial2 used for On Screen Display, only TX @ 115200 (could be as low as 19200) Serial3 used for comm with another Arduino, RX and TX @ 1200, 2400, or 4800 (very long cable)

What do you mean by "on screen display" - why can't that be done on Serial so that Serial2 is available for other things

...R

If I understand this correctly: GPS uses RX only, works fine without TX Serial Monitor uses TX only, unless you type in that little box in Serial monitor RX & TX are set to the same speed

if you set the Serial Monitor to 9600, the one Serial port can do two jobs

but you have to disconnect the GPS every time you upload the sketch

pylon: Use an USB host adapter that is connected by SPI instead of a UART interface.

Theoretically the GPS and the On Screen Display could be on the same serial interface.

GPS and OSD are not the same baudrate, and I did not find a way to use the same Serial with different baudrates for RX / TX

Robin2: What do you mean by "on screen display" - why can't that be done on Serial so that Serial2 is available for other things

...R

By OSD I mean a module (OSD-50HD from osdsystems) This could be moved to Serial, but then I would loose my debug functions

DeepLink:
By OSD I mean a module (OSD-50HD from osdsystems)
This could be moved to Serial, but then I would loose my debug functions

Couldn’t you display the debug messages on the OSD and comment out that code when the project is working?

Or get a second Mega to share the workload ? There is a point at which it no longer makes sense to use a huge amount of your time to avoid the small cost of another Mega.

…R

move TX only function to SoftwareSerial. and set the instance as TX only (I don't know how). RX is the troubled part of SoftwareSerial

GPS and OSD are not the same baudrate, and I did not find a way to use the same Serial with different baudrates for RX / TX

You did mention 19200 for both of them.

move TX only function to SoftwareSerial. and set the instance as TX only (I don't know how).

Set RX pin to -1.

RX is the troubled part of SoftwareSerial

Actually not completely correct. Both parts, sending and receiving are troublesome because the block interrupts for longer periods of time (transmission of a complete byte).