Communication between Multiple Arduino's through Soft-serial library

Hi,
i used soft-serial library to communicate multiple Arduino but the problem i am facing is that the data corrupts after some intervals as show in the below image, could any one please tell me how to solve this issue? thanks

as show in the below image

What image? I don't see any image.

I don't see any code, either.

oh sorry i think the image link was corrupted,

If you're using transparent mode to send the data, this can happen. The packet can get split into two and you get a mess. If you switch to api mode, use the XBee library and be sure to check the checksum on the packet. This kind of thing most often happens when you have the baudrate set high and are really putting the data into the XBee rapidly. It also happens when you have a number of XBees and there isn't enough guard time for the devices to sync up properly.

The latest XBee library supports software serial quite nicely and can help you with this kind of thing. Hunt around though and make sure you have the latest library.

thanks for reply, the first thing i clear to you that i am not using xbee , i communicate it through wire medium, secandly can you please tell me how to switch to API mode?

below is the code for the master i am using

#include <SoftwareSerial.h>

SoftwareSerial serialSlave1(3, 2); 

int indexSlave1=0;         
byte valSlave1[17];

void setup()  
{
  Serial.begin(115200);
  serialSlave1.begin(28800);
}
 
    float qSalve1[4],
 
    byte * f_1Slave1 = (byte *) &qSalve1[0];
    byte * f_2Slave1 = (byte *) &qSalve1[1];
    byte * f_3Slave1 = (byte *) &qSalve1[2];
    byte * f_4Slave1 = (byte *) &qSalve1[3];
    
void loop() 
{
  while(1<serialSlave1.available())
    {
       byte ch = serialSlave1.read();
       valSlave1[indexSlave1]=ch;
       indexSlave1++;
     if(ch=='\n'){ indexSlave1 = 0;}  
    }

       for(int fs=0;fs<4;fs++) f_1Slave1[fs]= valSlave1[fs];
       for(int fs=0;fs<4;fs++) f_2Slave1[fs]= valSlave1[fs+4];
       for(int fs=0;fs<4;fs++) f_3Slave1[fs]= valSlave1[fs+8];
       for(int fs=0;fs<4;fs++) f_4Slave1[fs]= valSlave1[fs+12];
       
        Serial.print(qSalve1[0],4);
        Serial.print(",");
        Serial.print(qSalve1[1],4);
        Serial.print(",");
        Serial.print(qSalve1[2],4);
        Serial.print(",");
        Serial.print(qSalve1[3],4);
        delay(15);
        
}

thanks for reply, the first thing i clear to you that i am not using xbee , i communicate it through wire medium, secandly can you please tell me how to switch to API mode?

below is the code for the master i am using

#include <SoftwareSerial.h>

SoftwareSerial serialSlave1(3, 2); 

int indexSlave1=0;         
byte valSlave1[17];

void setup()  
{
  Serial.begin(115200);
  serialSlave1.begin(28800);
}
 
    float qSalve1[4],
 
    byte * f_1Slave1 = (byte *) &qSalve1[0];
    byte * f_2Slave1 = (byte *) &qSalve1[1];
    byte * f_3Slave1 = (byte *) &qSalve1[2];
    byte * f_4Slave1 = (byte *) &qSalve1[3];
    
void loop() 
{
  while(1<serialSlave1.available())
    {
       byte ch = serialSlave1.read();
       valSlave1[indexSlave1]=ch;
       indexSlave1++;
     if(ch=='\n'){ indexSlave1 = 0;}  
    }

       for(int fs=0;fs<4;fs++) f_1Slave1[fs]= valSlave1[fs];
       for(int fs=0;fs<4;fs++) f_2Slave1[fs]= valSlave1[fs+4];
       for(int fs=0;fs<4;fs++) f_3Slave1[fs]= valSlave1[fs+8];
       for(int fs=0;fs<4;fs++) f_4Slave1[fs]= valSlave1[fs+12];
       
        Serial.print(qSalve1[0],4);
        Serial.print(",");
        Serial.print(qSalve1[1],4);
        Serial.print(",");
        Serial.print(qSalve1[2],4);
        Serial.print(",");
        Serial.print(qSalve1[3],4);
        delay(15);
        
}

Sorry, somehow I got the idea you were using an XBee. To address the problem you're seeing, why are you initializing like this:

byte * f_1Slave1 = (byte *) &qSalve1[0];

this is just because i use byte by byte value of a float variable, the slave send float value byte by byte and the master receive it in the same way. i think this may not be an issue, i some how reach to this problem that is it may be due to the interrupt call by any library either in slave or in master which is not good for Soft-serial communication.but did not know how to solve it :frowning: