Go Down

Topic: Regd : Serial Data Mirroring in DUE to LABVIEW (Read 513 times) previous topic - next topic


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 .

Code: [Select]

 const int IPIN_SYNC = 9;//chip select
 unsigned char reception_buffer[28];

void setup() {
  // initialize serial communication at 115200 bits per second:

  pinMode(13, OUTPUT);

  while (SerialUSB.read() >= 0) {} //http://forum.arduino.cc/index.php?topic=134847.0
  delay(2000);  // Catch Due reset problem
  digitalWrite(13, HIGH);
  Serial3.write(0x11);   //stop send data
  digitalWrite(13, LOW);
  Serial3.write(0x10);   //start send data
  digitalWrite(13, HIGH);

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
        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***********************


I also sync the data , but not sure my sync protocol works well.

Kindly give advice .



Go Up