4 Replies Latest reply on Nov 30, 2015 10:02 AM by arfoll

    How to transfer data using Uart in Galileo Gen 2

    chinna007

      Hi,

       

      I tried the below coding to transfer data from Intel Galileo Gen 2 to uart. But some error comes after building  in Eclipse

       

      #include<stdio.h>
      #include<unistd.h>
      #include<string.h>
      #include"mraa/uart.h"
      #define EXIT_SUCCESS 1
      int main(int argc, char** argv)
      {
           char tx_data[]="hello";
           char rx_data[]="";
           mraa_uart_context uart1;
           uart1=mraa_uart_init(0);
           mraa_uart_set_baudrate(uart1,9600);
      
           //mraa_uart_set_mode(uart1,8,MRAA_UART_PARITY_ONE,1);
           mraa_uart_write(uart1 ,tx_data, sizeof(tx_data));
           //printf("Tx_Data=%c",tx_data);
      
           //fprintf(stdout, "Gpio is %d\n",mraa_uart_write(uart1 ,tx_data, 4));
           mraa_uart_read(uart1 ,rx_data, sizeof(rx_data));
           //printf("Rx_Data=%c",rx_data);
           //mraa_uart_stop(uart1);
           //mraa_deinit();
           return EXIT_SUCCESS ;
      }
      

       

      after building time the following error coming.

      In file included from ..\src\tx.c:4:0:

      C:\iotdk-ide-win\devkit-x86\sysroots\i586-poky-linux/usr/include/mraa/uart.h:47:75: error: unknown type name 'mraa_uart_parity_t'

           mraa_result_t mraa_uart_set_mode(mraa_uart_context dev, int bytesize, mraa_uart_parity_t parity, int stopbits);

       

       

                                                                                                                     ^