Software Serial between two RX TX ports in the SAME BOARD??

Hello the title might seem weird but as of now I have only one board so before getting another board I just wanted to testing if its possible and I have seen various post with working codes with two boards but as I didn’t owe two development board so I just thought of doing the same thing with just one board but it does not seems to be working its there something wrong in my code or its not possible in one board(as its not meant to be that way).

I am using UNO as my development board!! and ArduinoThread for running multiple task

#include <Thread.h>
#include <ThreadController.h>
#include <SoftwareSerial.h>

SoftwareSerial serial1(12,13);  //Rx  Tx  13 --> 6      on the same board
SoftwareSerial serial2(6,7);    //Rx  Tx   7  --> 12     on the same board

ThreadController controll = ThreadController();

Thread thread_1 = Thread();

Thread thread_2 = Thread();

// callback
void callback_1(){
	Serial.println("Sending from Serial 1!!");
        serial1.print('1');
}


// callback
void callback_2(){
	Serial.println("Sending from Serial 2!!");
        serial2.print('2');
}

void setup(){
	Serial.begin(9600);
        serial1.begin(9600);
        serial2.begin(9600);
  
	// Configure callback 1
	thread_1.onRun(callback_1);
	thread_1.setInterval(10000);

	// Configure callback 2
	thread_2.onRun(callback_2);
	thread_2.setInterval(5000);
	

	// Adds Threads to the controll
	controll.add(&thread_2);
	controll.add(&thread_1);
}

void loop(){
	// run ThreadController
	// this will check every thread inside ThreadController,
	// if it should run. If yes, he will run it;
	controll.run();
 
  if(serial1.available()){
    Serial.print("AT Serial 1:");
    Serial.print(serial1.read());
    Serial.println();
  }
  
  if(serial2.available()){
    Serial.print("AT Serial 2:");
    Serial.print(serial2.read());
    Serial.println();
  }
}

You don't say how it is not working...

SoftwareSerial has documented limitations, in particular, when using multiple ports, only one can receive at any particular time. Check out the listen() function.

You could also try AltSoftSerial, but you could maybe run in to issues with the timers between it and Thread. Doesn't hurt to try though.

only one can receive at any particular time.

The active instance of SoftwareSerial is the only one that listens. Using any method of an instance of SoftwareSerial, to send, for instance, makes it the active instance. So, you can't listen to what another instance is sending.

Hmmm... that quit explains why I did not got any output.

Thx!!

You could use AltSoftSerial + NeoSWSerial to simulate this. However, AltSoftSerial only works on pins 8 & 9, and NeoSWSerial disables interrupts during TX (not RX). AltSoftSerial would not receive from NeoSWSerial. The other direction would work.

You could use Serial to transmit to a software serial port, if the receiving code ignores your debug prints. If the real messages have framing characters, it would skip debug messages. You'd also see the "real" messages on the Serial Monitor, which might be nice.