Hi ,
I am using Arduino DUE board to pack 12 channel data (500sps / per channel ) from ADC operating in SPI and send to SerialUSB port ( native USB ) with start byte .
If i read the data using LABVIEW using VISA protocol i am able to plot the nicely in individual channels , no issues and my flow control in serial mechanism is NONE (no handshaking ) . The data at receiver side is perfect no data loss etc .,
Problem :
I currently write the data to Serial3 port instead of SerialUSB port in my first board .,i receive the same data in another Arduino DUE Serial3 port and writing back to SerialUSB of Ardunio DUE second board .
But if i plot the data now in LABVIEW it is not plotting properly . The First Byte of the data which is identification byte 0xC0 is not showing as first byte in the Window . Data keep rolling .
I attached the connection method and code at the receiver side .
const int IPIN_SYNC = 9;//chip select
unsigned char reception_buffer[28];
void setup() {
// initialize serial communication at 115200 bits per second:
Serial3.begin(115200);
pinMode(13, OUTPUT);
pinMode(IPIN_SYNC, OUTPUT);
SerialUSB.begin(115200);
while (SerialUSB.read() >= 0) {} //http://forum.arduino.cc/index.php?topic=134847.0
delay(2000); // Catch Due reset problem
digitalWrite(13, HIGH);
delay(1000);
Serial3.write(0x11); //stop send data
digitalWrite(13, LOW);
delay(1000);
Serial3.write(0x10); //start send data
delay(1000);
digitalWrite(13, HIGH);
delay(1000);
}
void loop()
{
int i;
unsigned char rx=0;
unsigned char ptr = 0,count = 28;
//make the receiver READY pin low to indicate receiver controller is ready for reception
digitalWrite(IPIN_SYNC, LOW); //**********READY FOR RECEPTION**************
//Wait to get a start byte
do
{
rx=Serial3.read(); //receive a byte
}while( rx == 0xC0 );
reception_buffer[ptr++] = rx; //store the start byte into the reception buffer.
for(i = 0;i<count;i++) //receive a command
{
rx=Serial3.read(); //receive a byte
reception_buffer[ptr++] = rx;
}
SerialUSB.write(reception_buffer,count); // send to native USB port
//make the display READY pin high to indicate display controller is busy for reception
digitalWrite(IPIN_SYNC, HIGH); //**************BUSY***********************
delayMicroseconds(1);
}
I also sync the data , but not sure my sync protocol works well.
Kindly give advice .
-Pragdhees