Software Archive
Read-only legacy content
17060 讨论

UART Communication Galileo Gen1

Barath_L_
初学者
1,388 次查看

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 项奖励
8 回复数
Ashish_D_
初学者
1,388 次查看

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 项奖励
Barath_L_
初学者
1,388 次查看

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 项奖励
Ashish_D_
初学者
1,388 次查看

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 项奖励
Barath_L_
初学者
1,388 次查看

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 项奖励
Ashish_D_
初学者
1,388 次查看

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 项奖励
austin_s_
初学者
1,388 次查看

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 项奖励
austin_s_
初学者
1,388 次查看

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 项奖励
NagaVenkat_K_Intel
1,388 次查看

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 项奖励
回复