Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Novice
1,529 Views

How to transfer data using Uart in Galileo Gen 2

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

# include

# include

# 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);

^

4 Replies
Highlighted
28 Views

update mraa & your ide, should sort you out.

Highlighted
Novice
28 Views

Hi arfoll,

Can you share to me about updated Eclipse IDE and mraa libraries link.

Highlighted
Employee
28 Views

Hello china007,

Have you already tried with the mraa example found in https://github.com/intel-iot-devkit/mraa/blob/master/examples/uart.c mraa/uart.c at master · intel-iot-devkit/mraa · GitHub?

If you still run into issues, I'd suggest you to compile it directly on your board. It is very simple, just follow these steps:

1. Create the file where your code will be stored with "vi YOUR_FILE_NAME.c" and paste your code.

2. Compile the code and create an executable file with "gcc YOUR_FILE_NAME.c -o OUTPUT_FILE_NAME -lmraa"

3. Then run the code with ./OUTPUT_FILE_NAME

Peter.

Highlighted
28 Views

You'll want the latest IDE and the latest Edison image. You can browse the download dir too:

https://software.intel.com/en-us/iot/hardware/edison/downloads IoT - Intel® Edison Board Download | Intel® Developer Zone

 

The IDE does let you update mraa but latest image will be on mraa 0.8.1 already so that's your best bet.

0 Kudos