Software Archive
Read-only legacy content
17061 Discussions

UART Communication Galileo Gen1

Barath_L_
Beginner
959 Views

Hi all,

I'm trying program my Galileo to communicate using serial port.

I found the mraa library, it has the function to initialize serial communication, but couldn't find code to 'serial write and read'. It would be very helpful if you share some basic code for serial communication or give me some direction to program the same.

Thanks in advance.

0 Kudos
8 Replies
Ashish_D_
Beginner
959 Views

Here is some example SPI code using MRAA. Please let me know if this helps :)

http://iotdk.intel.com/docs/master/mraa/spi_8h.html

0 Kudos
Barath_L_
Beginner
959 Views

Thanks Ashish,

I get the following error when i try to compile the code

..\src\6_cpp_upm_i2c_grove_LCD.cpp: In function 'int main()':
i586-poky-linux-g++ "--sysroot=H:\\iotdk-ide-win\\devkit-x86\\sysroots\\i586-poky-linux" -lupm-i2clcd -o 6_cpp_upm_i2c_grove_LCD "src\\6_cpp_upm_i2c_grove_LCD.o" 
h:/iotdk-ide-win/devkit-x86/sysroots/i686-pokysdk-mingw32/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/4.8.2/ld.exe: src\6_cpp_upm_i2c_grove_LCD.o: undefined reference to symbol 'mraa_spi_init'
H:\iotdk-ide-win\devkit-x86\sysroots\i586-poky-linux/usr/lib/libmraa.so.0: error adding symbols: DSO missing from command line
collect2.exe: error: ld returned 1 exit status

I included mraa.h is there any other header to be included in elipse?

 

0 Kudos
Ashish_D_
Beginner
959 Views

Try compiling this one instead. https://github.com/intel-iot-devkit/mraa/blob/master/examples/spi_mcp4261.c ;

note on line 35:

spi = mraa_spi_init(0);

 

0 Kudos
Barath_L_
Beginner
959 Views

I still get the same error.

I want to use my xbee module. I need serial communication using Tx & Rx.  Any help would be appreciated.

0 Kudos
Ashish_D_
Beginner
959 Views

Okay so after some research I believe you are having a linking error. Check to see if the linker is adding MRAA. Just because you add it in the include folder does not mean it gets linked. I was getting the same error as you until I checked the linker and updated it. To update the linker right click your project -> Properties -> C/C++ Build -> Settings -> Cross G++ Linker

This is what my linker looks like: 

--sysroot=/Users/ashishdatta/Desktop/iotdk-ide-mac/devkit-x86/sysroots/i586-poky-linux -lupm-i2clcd -lmraa

0 Kudos
austin_s_
Beginner
959 Views

Hi,

Was an answer ever provided?

I would like to use the serial port on pins 0 and 1 with node.js and mraa (XDK IoT Edition).

Is this supported as I want to send data out over BT radio modules?

Thanks.

 

 

 

0 Kudos
austin_s_
Beginner
959 Views

Hi,

Did this ever get an answer?

I'd like to use a BT radio module on pins 0 &1 with XDK (IoT edition), and all the node.js examples are for analog and digital pins.

Thanks

 

0 Kudos
NagaVenkat_K_Intel
959 Views

Which board are you using?

If you are using Intel® Edison board, please refer this discussion to enable PIN0 and PIN1 for UART usage and for Bluetooth you can read this user guide for help.

Please feel free to post here if u need any help.

 

0 Kudos
Reply