Pass through serial communication on multiple arduinos

I need to connect 5 to 7 pro - mini's and I would like to pass the data in a "bucket brigade" style. I need to use pro - mini's because of the size restrictions. Each arduino needs to pass the data back and fro because the connections between they can be change with the system powered down. Once the system is powered up, we need to know the order in which they are configured. The speed can be very slow, 1-3 seconds. I tried to use the follow code and it worked, but very spotting. Do you think using "Altsoftserial" and the pro - mini's UART would give me better performance.

/*
This code is meant for the compiler. talks to the PC/Mac and the first arduino.
ID itself with a "H" and gives a state for the compile button

*/

#include <SoftwareSerial.h>
SoftwareSerial portOne = SoftwareSerial(4,5); //D4 is the RX for the softport

char inByte;
char outByte;
char idByte = 'H';
char stateByte = '1';
char recByte;
char pollByte = 'p';
int led = 13;

void setup()
{
// Open serial communications and wait for ports to open:
Serial.begin(9600);

portOne.begin(1200);

pinMode(led, OUTPUT);//.staute LED
}

void loop()
{
if (Serial.available() > 0)
{
inByte = Serial.read();
Serial.println(inByte);

if (inByte == pollByte)
{
Serial.print(idByte);
Serial.print(stateByte);
portOne.write(inByte);
delay(5);
digitalWrite(led, HIGH);

}
}

portOne.listen();
delay(5);
if (portOne.available() > 0)
{
recByte = portOne.read();
Serial.write(recByte);
Serial.println();

}

}

// code for the first following arduino

/*

Main blox sends polling ASCII. First blox receives poll and sends a ASCII
and state back to Main blox, then sends polling ASCII to next blox. passes
the receiving ASCII and state back to the main blox.
*/

#include <SoftwareSerial.h>
// Up stream port
SoftwareSerial portIn = SoftwareSerial(2,3);
// Down stream port
SoftwareSerial portOut = SoftwareSerial(4,5);

char inByte;
char outByte;
char idByte = 'B';
char stateByte = 1;
char recByte;
char pollByte = 'p';
int led = 13;

void setup()
{
portIn.begin(1200);
portOut.begin(1200);
pinMode(led, OUTPUT);

}

void loop()
{
portIn.listen();
delay(5);

if (portIn.available() > 0) {
inByte = portIn.read();
if (inByte == pollByte)
{
portIn.write(idByte);
delay(5);
portIn.write(stateByte);
delay(5);
portOut.write(inByte);
delay(5);
digitalWrite(led, HIGH);

}}
portOut.listen();
delay(5);

if (portOut.available() > 0) {
recByte = portOut.read();
portIn.write(recByte);
delay(5);
}
}

Blox_smallB.ino (1.07 KB)

That system won't work reliably with SoftwareSerial. Although you call the listen() method in order during the loop() run you will loose data because any data being sent to port one during the listen() period of port two will be lost. AltSoftSerial and the hardware UART are better choices but from your description it may be a better solution to either use I2C (if you have one master and several slaves, as well as connections below about half a meter between the devices) or RS485 (which will need some additional hardware) together with the hardware UART.

If you tell us a bit more about your project we might give you more appropriate hints.

Thanks for the feedback.
A little more detail. Each arduino is inside a puzzle piece and their physical arrangement can be changed. I need to know the order of each piece. Since the puzzle order can change when powered down, the problem with a universal bus for communication is not being able to tell which piece is ahead of another.
Hope that helps.

Update-
System is working. Still using SoftwareSerial, but I'm only using one port. Replaced the second one with the arduino hardware UART.

Thanks for your time.