[SOLVED] Couldn't use ./susv -status ( can't access i2c device )

mustafaxfe
mustafaxfe New Member Posts: 4
edited July 2018 in UP Board Linux

Hi,
I have followed this "https://wiki.up-community.org/Ubuntu#Enable_the_HAT_functionality_from_userspace" tutorial to get i2c access.
Also, I have connected "UPS and wide range DC-in HAT" and installed its software for up-board:
https://shop.olmatic.de/en/content/7-downloads.
But, couldn't work. Its daemon starts without problem:
cd /opt/susvd/
sudo ./susvd -start
But when I try to read its status:
./susv -status
It gives:
Unable to select I2C device
I have installed i2c-tools and i2cdetect gives these outputs:
connecticals@connecticals-UP-CHT01:/opt/susvd$ i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
connecticals@connecticals-UP-CHT01:/opt/susvd$ i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
connecticals@connecticals-UP-CHT01:/opt/susvd$ i2cdetect -y 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- 3a -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 -- -- -- -- 55 -- -- -- -- 5a -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
What should I do for accessing i2c devices.
Thanks in advance.

Tagged:

Best Answer

Answers

  • Michael McCool
    Michael McCool New Member Posts: 19
    edited May 2018

    I am having the exact same issue. I see some devices when I scan bus 2 but they don't match the U.USV docs, which give commands to scan bus 1; but when I do a scan, both bus 0 and bus 1 are empty. The docs are a little vague about whether i2c-1 is the one used for the HAT but that is what the pinout docs seem to imply. I do see a couple of things (strangely, in different places than you) when I scan bus 2.

    At any rate, things I have tried:

    • Updating to the latest BIOS (UPCDM11) and kernel (4.10.0-42-upboard10-Ubuntu). It didn't work with the old BIOS, either. Using default BIOS setting (eg ACPI for i2c) except for the speed tweaks noted below.
    • Reducing the speed of i2c-1 to 100kHz using the BIOS setting (under the HAT menu).
    • Reducing the speed of both i2c ports to 100kHz in the BIOS
    • Testing GPIOs. These work (at least, I can turn the RGY LEDs under the board on and off). That tells me I have the right drivers, kernel, permissions, etc.
    • Tried fancier i2cdetect options, namely "i2cdetect -r -a -y 1" which is supposed to be more robust; however, I got the same results.

    Things I haven't tried yet:

    • Using i2c-2. Maybe one of the devices showing up on the scan is in fact the U.USV? I don't want to poke at things randomly in case that is something else, though.
    • Disabling one of i2c-1 or i2c-2. There was a bug reported where enabling one i2c port disabled another on the UP2. Could something similar be going on here?

    Information:

    • I am using a version of the UP Board from last year (with active cooling) that was included with the Intel Robotics Development Kit. It may be this problem is specific to particular versions of the board so we should try to be specific. I will have to figure out the specific model number of the board (if someone can tell me where to find it).
    • The U.USV does work just as a "UPS". But I really need the i2c interface to monitor the charge state as I'm using this in a robot where I need to disconnect from wall power (the robot is supposed to return to a charge station when its battery gets low, so I need to be able to monitor it, shutdown gracefully if the robot can't make it back, etc. etc.)
    • Running Ubuntu 16.04.3, because ROS.
  • Michael McCool
    Michael McCool New Member Posts: 19
    edited May 2018

    I don't know if it's relevant but I noticed there were no udev rules for gpio, i2c, or spi. The following thread seems to imply there should be:
    https://forum.up-community.org/discussion/2141/tutorial-gpio-i2c-spi-access-without-root-permissions#latest
    However, I don't think this is the problem since my scan comes back empty when I use sudo, too, and I don't get any complaints about lacking permissions when I tweak the LEDs and run i2cdetect in user mode (I did add my $USER to all the groups indicated in the cited tutorial).
    There was another thread that mentioned i2c devices not showing up for a while so I waited a few hours and did a scan. Nope, still not showing up...

    Later when I have time I will try putting a logic analyser on the i2c pins and see if there are any bits getting twiddled when I run a scan. That may help figure out whether it is a SW or firmware issue (eg CPLD config) or a HW issue (eg pullups too weak or too strong).

  • ccalde
    ccalde New Member Posts: 348 ✭✭✭

    Hi all,

    Any update for that issue?

    Cheers!

  • BenSpex
    BenSpex New Member Posts: 8

    Hi,
    I'm having the same issue and can't get the USP to work under Ubuntu 18.04 switching to Ubilinux is not an option.
    Any ideas on what to do here?

    Thanks

  • joaoquintas
    joaoquintas New Member Posts: 1
    edited August 2019

    Hi,

    I was having the same problem while setting up the UP board with Ubuntu 18.04.

    I followed some information in the documentation of UP board (https://wiki.up-community.org/Pinout) where it indicated the i2c devices to be in /dev/i2c-0 and /dev/i2c-1 and /dev/i2c-5 and from Olmatic SUSV manual (http://www.s-usv.de/files/pdf/SUSV_Manual_Rev2_0_EN.pdf) page 35 (Troubleshooting)

    Running $sudo i2cdetect -y -r 5 reproduced the result that the manual refers with $sudo i2cdetect -y 1

    Edited the susvd.cfg file (located in /opt/susvd folder) in the line below [i2c] from:
    device="/dev/i2c-1"

    to
    device="/dev/i2c-5"

    Restarted the daemon (from /opt/susvd)
    $sudo ./susvd -restart

    Then all commands described in the manual started working normally and the immediate change I noticed was the LEDs starting working correctly. Meaning, from green, led blinking indicating firmware loading and red led for the battery to steady green and yellow battery (charging).

    Hope this helps.

Tagged