Main Site Documentation

Com trouble. Need help Please…


I am new to micro framework and I have been ask to design a high speed serial logger. So I start with panda II. When receiving I am missing some of the RX data. My data packet is 92 bytes long and I am getting 32 packets in 1 second and I have 3 of these channels coming to the system at same time.

My simple code as follows
public static void Comm2_Thread()
SerialPort UART = new SerialPort(“COM4”, 57600);
byte[] rx_byte = new byte[2000];
int read_count = 0;

        while (true)
            // Thread.Sleep(1000);
            read_count = UART.Read(rx_byte, 0, 2000);
            string pk1 = "";

            if (read_count > 0)// do we have data?
                int xx_cou = 0;
                while (xx_cou < read_count)

                        byte[] a1 = new byte[1];
                        a1[0] = rx_byte[xx_cou];
                        string a2 = new     string((Encoding.UTF8.GetChars(a1)));

                        pk1 = pk1 + a2;
                    catch { }

                    xx_cou = xx_cou + 1;

            Debug.Print("COM4  " + pk1);

I am getting overlap of packets in 256th to ~ 266th byte, but next 1744 is perfect. My first thought was my TX data stream too fast and I set to transmit only 2 packets per second but error is still there. Then I try to get only first 200 bytes at a time but in some times I get few data missing in the middle. I know at the moment I am not synchronize the incoming data but it should not be a problem when I am interested in reading the buffer.

Sample of incoming data
Packet overlapping due to error

Am I expecting too much from Panda II or I am missing some thing?
I really need a solution quickly


Why post multiple times? Why ask us to answer asap?

We always respond asap and answer every question!!