5 Replies Latest reply on Mar 18, 2016 11:46 AM by Intel_Alvarado

    XBee receiving Junk bytes on Intel IoT Eclipse

    KS_Nathan

      I am trying to use eclipse and C in order to receive the UART data from the XBee connected to the galileo.

      But I am receiving the packets which contain my message but are attached with some other junk "accomplices".

      PLease check out the below:

       

      frame:1--> 7e,0,18,ffffff92,0,13,ffffffa2,0,

      40,ffffffe9,1b,ffffffc2,fffffff1,76,1,1,

      0,0,f,2,8,0,0,2,

      9,2,9,1a,

      -------------------------------------------

      frame:2--> 7e,0,18,ffffff92,0,13,ffffffa2,0,

      40,ffffffe9,1b,ffffffc2,fffffff1,76,1,1,

      0,0,f,3,ffffffff,3,ffffffff,3,

      ffffffff,3,ffffffff,32,

       

      Actually this is a IO sample indicator where the DIO are disabled and the all the ADC inputs are enabled.

      The second ADC is attached to  motion sensor which is why the two frames look dissimilar.(one -->no motion, two-->motion).

       

      The C code is put below, pls check it:

      #include <stdio.h>

      #include <stdlib.h>

      #include "mraa.h"

      int main() {

      mraa_uart_context u0;

      u0 = mraa_uart_init(0);

      mraa_uart_set_baudrate(u0,9600);

      char bytes[26];

        for (;;) {

         if(mraa_uart_data_available(u0,2000)){

         int nbytes = mraa_uart_read(u0,bytes,26);

         if(nbytes > 0){

         int i=0;

         for(;i<nbytes;++i){

         printf("%x,",bytes[i]);

         }

         //printf("%x",bytes[0]);

       

       

         }

       

       

         }

         printf("\n");

        }

       

       

        return 0;

      }

      ----------Sorry for the bad indentation-----------------

      Any suggestions/inputs/solutions are most welcomed and heartily appreciated..

      Thank you.

      Nathan.