Two SoftwareSerial don't work! Help!

Hello. I've made a search on google but do not find an answer to my question, and the examples didn't work.

I have an Arduino UNO with 2 SoftwareSerial ports: one using the pins 2 and 3, and the other 10 and 11.

The first (pins 2 and 3) are connected to a GPS, and the second (10 and 11) are connected to a external cable. My need is: receive data from GPS, format it and send to the cable. but this do not work.

For a test I wrote only one line for the second SS. If I comment these lines I can monitor the data. If I comment I only can see the data from second software serial port.

//SoftwareSerial mySerialB(10, 11);

//mySerialB.begin(9600);

//mySerialB.println("mySerialB");

Full code:

#include <SoftwareSerial.h>
#include <TinyGPS.h>

SoftwareSerial mySerialA(2, 3);
//SoftwareSerial mySerialB(10, 11);
TinyGPS gps;

void gpsdump(TinyGPS &gps);
void printFloat(double f, int digits = 2);

void setup()  
{
  mySerialA.begin(9600);
  //mySerialB.begin(9600);
  Serial.begin(9600);
  delay(1000);
}

void loop()
{
  bool newdata = false;
  
  //mySerialB.println("mySerialB");
  if (mySerialA.available())
  {
    char c = mySerialA.read();
    if (gps.encode(c))
    {
      newdata = true;
    }
  }
  if (newdata)
  {
    gpsdump(gps);
  }
}

void gpsdump(TinyGPS &gps)
{
  float flat, flon;
  unsigned long age;

  gps.f_get_position(&flat, &flon, &age);
  Serial.print("Lat: ");
  printFloat(flat, 5);
  Serial.println(" ");
  Serial.print("Lon: ");
  printFloat(flon, 5);
  Serial.println(" ");
}

void printFloat(double number, int digits)
{
  // Handle negative numbers
  if (number < 0.0)
  {
     Serial.print('-');
     number = -number;
  }

  // Round correctly so that print(1.999, 2) prints as "2.00"
  double rounding = 0.5;
  for (uint8_t i = 0; i < digits; ++i) rounding /= 10.0;
  number += rounding;

  // Extract the integer part of the number and print it
  unsigned long int_part = (unsigned long)number;
  double remainder = number - (double)int_part;
  Serial.print(int_part);

  // Print the decimal point, but only if there are digits beyond
  if (digits > 0) Serial.print("."); 

  // Extract digits from the remainder one at a time
  while (digits-- > 0)
  {
    remainder *= 10.0;
    int toPrint = int(remainder);
    Serial.print(toPrint);
    remainder -= toPrint;
  }
}

From the SoftwareSerial reference page

The library has the following known limitations:
If using multiple software serial ports, only one can receive data at a time.

Could that be a problem for you ?

It goes on to say

If your project requires simultaneous data flows, see Paul Stoffregen's AltSoftSerial library. AltSoftSerial overcomes a number of other issues with the core SoftwareSerial, but has it's own limitations. Refer to the AltSoftSerial site for more information.

Pins 2&3 are connected to external processor ( 16U2 on Due) which collects the incoming serial data and puts it in "standard " Serial buffer no matter what the Arduino app is doing.
The "external hardware" is the key.

I would suggest you look into source code for SoftwareSerial to find out how the incoming data is collected.
I would not assume the collection method is "automatic" and same as Serial.

You should be able to use SoftwareSerial "buffer" , irregardless how it actually works, and read the standard "Serial" buffer at your leisure.

Of course you need to make sure you do not overrun the "Serial" buffer and loose data.

@Vaclav, I cannot see how any of Reply #2 is relevant to the OP's problem.

...R