Software Archive
Read-only legacy content
17061 Discussions

Tried to run cpp_upm_i2c_grove_LCD sample code with Edison and failed

pierre_w_
Beginner
2,327 Views

I tried to run other cpp sample codes with Edison in Eclipse IDE. Helloworld and LED blink are working perfectly.

When I tried to run cpp_upm_i2c_grove_LCD (I connected the Grove LCD to my board) and it gave me error:

/home/pierre/iot2/iotdk-ide-linux/iot-devkit/workspace/6_cpp_upm_i2c_grove_LCD/Debug/6_cpp_upm_i2c_grove_LCD: error while loading shared libraries: libupm-i2clcd.so.0: cannot open shared object file: No such file or directory

How can I resolve this issue?

 

0 Kudos
1 Solution
Matthias_H_Intel
Employee
2,327 Views

which command you refer to?

btw: I suppose you are trying to run the lcd demo locally on your computer rather than remotely. You might check Right click on Project -> "Run As ..." and there select the target like shown below (I called my Edison target "edison"):

runAs.jpg

View solution in original post

0 Kudos
11 Replies
Matthias_H_Intel
Employee
2,327 Views

have you upgraded libmraa / UPM? Which versions do you have?

[plain]

# opkg info libmraa0 | head -n 2
Package: libmraa0
Version: 0.5.0.19

# opkg info upm | head -n 2
Package: upm
Version: 0.1.8.31

[/plain]

If it's an old version you might have to setup opkg with something like

[bash]

cat > /etc/opkg/mraa-upm.conf <<EOF
src mraa-upm http://iotdk.intel.com/repos/1.1/intelgalactic
EOF

opkg update && opkg upgrade

[/bash]

 

 

0 Kudos
pierre_w_
Beginner
2,327 Views

They are all up-to-date. I believe the eclipse ide C++ doesn't have the library libmraa.so. I tried to follow this guide 

https://github.com/intel-iot-devkit/mraa

and 

https://github.com/intel-iot-devkit/mraa/issues/8

But I have no success because I can't find out where the library is installed.

0 Kudos
Matthias_H_Intel
Employee
2,327 Views

Actually the Eclipse IDE has libmraa.so - otherwise you couldn't have compile the LED blink sample. You can check the compilation in the Eclipse Build console (replaced the actual path with <iotdk home>) which should look like:

[plain]

i586-poky-linux-g++ "-I<iotdk home>/devkit-x86/sysroots/i586-poky-linux/usr/include" "-I<iotdk home>/devkit-x86/sysroots/i586-poky-linux/usr/include/c++" "-I<iotdk home>/devkit-x86/sysroots/i586-poky-linux/usr/include/c++/i586-poky-linux" "-I<iotdk home>/devkit-x86/sysroots/i586-poky-linux/usr/include/upm" -Os -g3 -Wall "--sysroot=<iotdk home>\\devkit-x86\\sysroots\\i586-poky-linux" -m32 -march=i586 -c -ffunction-sections -fdata-sections -o "src\\6_cpp_upm_i2c_grove_LCD.o" "..\\src\\6_cpp_upm_i2c_grove_LCD.cpp" 
i586-poky-linux-g++ "--sysroot=<iotdk home>\\devkit-x86\\sysroots\\i586-poky-linux" -lupm-i2clcd -o 6_cpp_upm_i2c_grove_LCD "src\\6_cpp_upm_i2c_grove_LCD.o" 

[/plain]

The library libupm-i2clcd itself depends on libmraa0 as you can see running ldd

[plain]

# ldd /usr/lib/libupm-i2clcd.so
    linux-gate.so.1 (0xb7713000)
    libmraa.so.0 => /usr/lib/libmraa.so.0 (0xb76f0000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7606000)
    libm.so.6 => /lib/libm.so.6 (0xb75b9000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb75a5000)
    libc.so.6 => /lib/libc.so.6 (0xb742e000)
    libpthread.so.0 => /lib/libpthread.so.0 (0xb7412000)
    /lib/ld-linux.so.2 (0x4b172000)

[/plain]

So something seems wrong with your setup on Eclipse.

That said: the unmodified version of grove lcd won't run on Intel(R) Edison Arduino board. You'd have to replace the I2C channel 0 to 6. You can do like following (this is the version I'll update some time to the Eclipse samples):

/*
 * Author: Yevgeniy Kiveish <yevgeniy.kiveisha@intel.com>
 * Matthias Hahn <matthias.hahn@intel.com>
 * Copyright (c) 2014 Intel Corporation.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#include "jhd1313m1.h"
#include "mraa/types.h"

int
main(int argc, char **argv)
{
    // 0x62 RGB_ADDRESS, 0x3E LCD_ADDRESS
    upm::Jhd1313m1 *lcd;
    mraa_platform_t platform = mraa_get_platform_type();
    switch (platform) {
    case MRAA_INTEL_EDISON_FAB_C:
    	lcd = new upm::Jhd1313m1(6, 0x3E, 0x62);
    	break;
    default:
       	lcd = new upm::Jhd1313m1(0, 0x3E, 0x62);
       	break;
    }
	lcd->setCursor(0,0);
    lcd->write("Hello World");
    lcd->setCursor(1,2);
    lcd->write("Goodbye");
    lcd->close();
}

You would have to additionally link to libmraa in order to run this

 

 

0 Kudos
pierre_w_
Beginner
2,327 Views

where do i run this command ? I tried it on my computer it's not found.

0 Kudos
Matthias_H_Intel
Employee
2,328 Views

which command you refer to?

btw: I suppose you are trying to run the lcd demo locally on your computer rather than remotely. You might check Right click on Project -> "Run As ..." and there select the target like shown below (I called my Edison target "edison"):

runAs.jpg

0 Kudos
pierre_w_
Beginner
2,327 Views

Opps sorry. I meant this command:\

ldd /usr/lib/libupm-i2clcd.so

0 Kudos
pierre_w_
Beginner
2,327 Views

Thanks a lot matthias-hahn (Intel). You are right. I was running on my local. Now the program is running on Edison. Sorry I am a noob haha. Btw, when I tried the Grove LCD demo, it said Segmentation fault. Any idea? 

 

0 Kudos
Matthias_H_Intel
Employee
2,327 Views

pierre w. wrote:

Thanks a lot matthias-hahn (Intel). You are right. I was running on my local. Now the program is running on Edison. Sorry I am a noob haha. 

No problem. Good it's running now

pierre w. wrote:

Btw, when I tried the Grove LCD demo, it said Segmentation fault. Any idea? 

Sure. That's why I mentioned the program wouldn't run unmodified on Edison. I put the other source code. If it's just for Edison you will have to only change the I2C channel from 0 to 6 (see my code)

0 Kudos
pierre_w_
Beginner
2,327 Views

 

Thank you very much. Now the LCD sample is running. Thanks a lot!

0 Kudos
Matthias_H_Intel
Employee
2,327 Views

Good to see you have it working.

On more thing I forgot to mention: We started putting updates for libmraa and upm to http://iotdk.intel.com/sdk/mraa-update/, and http://iotdk.intel.com/sdk/upm-update/ respectively to keep the IDE up to date. You can take the latest of those zips each and extract in the home folder of your IDE installation. It will by purpose overwrite existing files. Within the IDE you might have to right click a project -> Index -> Rebuild in order to make Eclipse aware of those changes. 

0 Kudos
Farkas__Ivan
Beginner
2,327 Views

Running the 3_c_onboard_LED_blink eclipse project, but there is no blinking.

Updated libmraa, UPM on the Edison Arduino board.

root@edison1:~# opkg info libmraa0 | head -n 2
Package: libmraa0
Version: 0.5.2.42

root@edison1:~# opkg info upm | head -n 2
Package: upm
Version: 0.1.8.55

Extracted win-mraa-0.5.2.6.zip and win-upm-0.1.8.55.zip in the home folder of my IDE installation, updating mraa and upm.

Added section to identify the Edison board.

case MRAA_INTEL_EDISON_FAB_C:
  strcpy(board_name, "Edison");
  gpio = mraa_gpio_init(13);
  break;

Rebuild indexes and projects. When running, getting this output, but now blinks.

root@edison1:~#
echo $PWD'>'
/home/root>
root@edison1:~#
root@edison1:~# chmod 755 /tmp/3_c_onboard_LED_blink;/tmp/3_c_onboard_LED_blink;
exit
Welcome to libmraa
 Version: v0.5.2-42-g27f22d0
 Board: Edison

Any help is greatly appreciated.

0 Kudos
Reply