Unable to detect sensors on with i2cdetect

ChaseRLewis73003
ChaseRLewis73003 New Member Posts: 9

I have an IMU i've used with my Edison, Arduino Due, and Arduino Uno the BNO055. I rewrote the code awhile back to work with MRAA on the Edison. I am wanting to use the UP Board as I have a new application that requires a bit more horse power.

From testing it seems the pins are using the Linux numbers on the pinout sheet
https://wiki.up-community.org/Pinout

So i'm enabling pin 2 & 3 using

echo "2" > /sys/class/gpio/export
echo "3" > /sys/class/gpio/export

are there any other commands i need to enable i2c for these pins? I've made sure the device is operating at 100kHz as i've had issues with 400kHz on other devices with this sensor in the bios, but other than that can't figure out why it isn't detecting it as i've checked to see if the sda/scl pinout was reversed also. I assume i'm missing something in the setup ... just not sure what that is.

Comments

  • ChaseRLewis73003
    ChaseRLewis73003 New Member Posts: 9

    Since I don't see an Edit, just mentioning I installed the 16.04 Ubuntu according to the wiki and have got normal GPIO to work. It is just i2c i haven't been able to get to detect devices. Pin 2-3 i believe are supposed to be i2c-1 but I've test i2c-0 and i2c-1 each time just in case.

  • ccalde
    ccalde New Member Posts: 348 ✭✭✭

    Hi @ChaseRLewis73003 ,

    Could you show me the output for i2cdetect?
    What is the specific pinout setup for your i2c device?

    Cheers!

  • ChaseRLewis73003
    ChaseRLewis73003 New Member Posts: 9

    @ccalde said:
    Hi @ChaseRLewis73003 ,

    Could you show me the output for i2cdetect?
    What is the specific pinout setup for your i2c device?

    Cheers!

    showing i have the pins exported (I have not ran ANY other commands then exporting them, no direction etc)

    Pin Setup
    Pin 1 - 3.3V output to the Vin of the sensor
    Pin 3 (Linux GPIO 2) - SDA of sensor
    Pin 5 (Linux GPIO 3) - SCL of sensor
    Pin6 (Ground) - Ground of Sensor

    Images

    Sensor has 10k pullups and works 3.3V - 5V. I have a couple other sensors/small screens that are i2c i'll try and see if I can get anything working in the mean time.

  • ChaseRLewis73003
    ChaseRLewis73003 New Member Posts: 9
  • ChaseRLewis73003
    ChaseRLewis73003 New Member Posts: 9

    @ccalde

    I've tried 4 different i2c sensors and then tried them each on my Edison with a level shifter. None of them showed on the up board, all of them showed on the edison. Any help would be much appreciated as this is a major hold up currently.

  • nukular
    nukular New Member Posts: 61 ✭✭✭

    Do you have access to any kind of Logic Analyzer or Oscilloscope so you can at least verify that any kind of I2C communication is happening?

  • ChaseRLewis73003
    ChaseRLewis73003 New Member Posts: 9
    edited September 2018

    Pretty unimpressive the pins default to high when the device is turned on (why on Earth is that?) and don't change when enabled unless the value is specified . Running i2cdetect doesn't change the outputs on the the scl output. My guess again is there are more commands that need to be done. If I call value the for a pin the output dies change as expected.

  • nukular
    nukular New Member Posts: 61 ✭✭✭

    I could be wrong, since I have never used I2C on the UP, but I don't think you should "enable" the pins via sysfs like you do. Because then they are configured as GPIOs and probably can't be used for I2C anymore.

  • ChaseRLewis73003
    ChaseRLewis73003 New Member Posts: 9

    @nukular said:
    I could be wrong, since I have never used I2C on the UP, but I don't think you should "enable" the pins via sysfs like you do. Because then they are configured as GPIOs and probably can't be used for I2C anymore.

    They don't default to being used like i2c either. That is why i'm assuming there is a set of commands needed to get them to work and set them into i2c mode. I just can't find any documentation regarding it.

  • nukular
    nukular New Member Posts: 61 ✭✭✭

    @ChaseRLewis73003 said:
    They don't default to being used like i2c either

    Mhh... according to the Pinout Wiki page they should:

    "In general, the pin will be configured by default for the alternate function at boot time if the corresponding controller (e.g. I2C-1) is enabled in the BIOS"

    In the BIOS screenshot you posted at the bottom, there is a I2C0/GPIO Selection option, which is set to GPIO. Maybe try setting that to I2C and then try I2C again without exporting the GPIOs.

  • ChaseRLewis73003
    ChaseRLewis73003 New Member Posts: 9
    edited September 2018

    @nukular said:

    @ChaseRLewis73003 said:
    They don't default to being used like i2c either

    Mhh... according to the Pinout Wiki page they should:

    "In general, the pin will be configured by default for the alternate function at boot time if the corresponding controller (e.g. I2C-1) is enabled in the BIOS"

    In the BIOS screenshot you posted at the bottom, there is a I2C0/GPIO Selection option, which is set to GPIO. Maybe try setting that to I2C and then try I2C again without exporting the GPIOs.

    Nope that doesn't work either. I've tried just about everything that I should reasonably be expected to check on my own. Have found multiple other threads for many UP boards that seem to all have the same issue. I guess this board is not marketed correctly and does not support the functionality it claims as this seems to be a very common issue (I question whether it works on any UP board given the number of threads I've seen complaining about this).

  • Dan O'Donovan
    Dan O'Donovan Administrator, Moderator, Emutex Posts: 241 admin

    Hi @ChaseRLewis73003

    @nukular is correct above. You should not export those pins as GPIOs, as this will select the GPIO function instead of the I2C function on those pins.

    First, you need to determine the correct I2C bus number. This can be done with the following command:
    ls /sys/devices/pci0000:00/808622C1:01/ | grep i2c

    If, for example, you got i2c-4 then your bus number is 4. Scan for I2C devices on that port using the following command.

    sudo i2cdetect -r -y 4

    I hope that helps.

    Regards,
    -Dan

  • ChaseRLewis73003
    ChaseRLewis73003 New Member Posts: 9

    Hello @Dan O'Donovan the grep says it is i2c-0 which i kinda assumed as I found some conflicting documentation some saying i2c-1 or i2c-0 so have ran all my tests on both throughout. As mentioned above i2c-0 gives nothing back, I have also tried with and without exporting GPIO so that alone doesn't fix the issue. Unfortunately that providing no results is the reason I have made this thread.

    I generally have connected my SDA to 3 (linux pin 2) and my SCL to 5 (linux pin 3). Is that correct. I see there are some other i2c pins marked but they have abbreviations I'm not familiar with. I tried those also and got no response. I tried pins 27 & 28 also since they mention 'i2c-0' also but they don't provide any response from 3 different sensors I have tried and confirmed work with other devices.

  • waynepiekarski
    waynepiekarski New Member Posts: 28 ✭✭

    Did you end up finding a solution to this problem?

    I'm also experiencing a similar problem where I cannot find anything on the I2C bus. The documentation is all either non-existent or out of date. I've tried both Ubuntu 18.04 and Ubilinux, and I've tried using i2cdetect for every device from /dev/i2c-0 up to 10 or however many there are, and my devices are never found. Everything works fine with the same I2C devices with an RPi3 so I know my external devices are ok.

    Here is my forum posting: https://forum.up-community.org/discussion/3650/i2cdetect-y-1-failing-with-i2c-designware-808622c1-04-controller-timed-out#latest

Privacy Policy