1 of 1 people found this helpful
The only busses available for user are #1 and #6 (for main CPU) and #8 (for SCU/MCU). For bus #1 you see GPIO expanders connected (Edison/Arduino variant very likely). So, if you connect your device to bus #6 you need to be sure that pins are in proper mode (i.e. mode 1) to be visible for OS. Otherwise they are muxed to I2C8 or bus #8 (SCU/MCU peripheral host controller).
Thanks for reaching out!
What Oandriy said is true, you should take it into consideration before trying to use the I2C bus manually. I would also like to tell you that before you can use the I2C bus, you have to set it up in order to be accessible through the GPIOs on the expansion board. You can do so with the following script:
echo 28 > /sys/class/gpio/export
echo 27 > /sys/class/gpio/export
echo 204 > /sys/class/gpio/export
echo 205 > /sys/class/gpio/export
echo 236 > /sys/class/gpio/export
echo 237 > /sys/class/gpio/export
echo 14 > /sys/class/gpio/export
echo 165 > /sys/class/gpio/export
echo 212 > /sys/class/gpio/export
echo 213 > /sys/class/gpio/export
echo 214 > /sys/class/gpio/export
echo low > /sys/class/gpio/gpio214/direction
echo high > /sys/class/gpio/gpio204/direction
echo high > /sys/class/gpio/gpio205/direction
echo in > /sys/class/gpio/gpio14/direction
echo in > /sys/class/gpio/gpio165/direction
echo low > /sys/class/gpio/gpio236/direction
echo low > /sys/class/gpio/gpio237/direction
echo in > /sys/class/gpio/gpio212/direction
echo in > /sys/class/gpio/gpio213/direction
echo mode1 > /sys/kernel/debug/gpio_debug/gpio28/current_pinmux
echo mode1 > /sys/kernel/debug/gpio_debug/gpio27/current_pinmux
echo high > /sys/class/gpio/gpio214/direction
I hope this information helps you,
Hi Pedro M,
Sorry for the late reply. I ran the script. However, the results were the same as posted above.
Result of script:
I'm not sure what the issue is. My wiring configuration is as follows for the sensor and the Arduino Breakout Board:
SHT31-D | Arduino Breakout Board
5V <--> Vin
GND <--> GND
SDA <--> A4
SCL <--> A5
Don't worry those messages are expected, what they mean is that those GPIOs have already been exported. However, we don't know if that's always going to be the case, so, those lines have to be included in the script.
In fact, these lines are those explained in the Arduino Expansion board hardware guide (http://download.intel.com/support/edison/sb/edisonarduino_hg_331191007.pdf) in section 11.6 to configure the I2C pins. The only difference is that I made them a script for ease of use.
Did you try to check the I2C bus after running the script?
I checked the I2C bus after running the script and I got the following:
i2cdetect for bus 1:
i2cdetect for bus 2, 4-6
i2cdetect for bus 3 (crashes and I have to reset the board)
Is there a particular setting/setup I have to change on the board?
I am able to access the sensor through Arduino IDE. However, I can't detect the sensor via Linux.
As Oandriy mentioned and as you can check in section 4.2 of the module's hardware guide (http://download.intel.com/support/edison/sb/edisonmodule_hg_331189004.pdf), Edison has only two I2C interfaces available, I2C1 and I2C6. This is true to the module, however, it is different in the expansion board. You can see it in a graphic mode in Figure 2 of the expansion board's hardware guide (http://download.intel.com/support/edison/sb/edisonarduino_hg_331191007.pdf), you can see two I2C interfaces coming out from the module but one of them is four expander ports, leaving only one interface available to the user. This last I2C interface goes from the module to a multiplexer and then to the physical output. This interface is I2C6.
What I explained above if the reason why you see something detected in the I2C1 interface. Try running again the script and them enter the command i2cdetect -y -r 6 with your device connected and let us know what happens.
Thanks a lot for sharing this information with us. Please let us analyze it to see if we can determine what might be happening. If we are able to find anything useful, we'll make sure to share it with you in this thread.
I recommend you to use the MRAA library just to see if the sensor is detected. MRAA should configure the interface automatically and we might see a different result. You would have to write a simple code for this test or find an example code for the sensor he is using. You can find the examples in https://github.com/intel-iot-devkit/mraa/tree/master/examples
I would like to ask you if when you refer to the Arduino IDE, if you actually used an Arduino UNO or the Edison programmed through the Arduino IDE.
1 of 1 people found this helpful
You should see:
root@edison:~# i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: UU UU UU UU -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
This show 4 muxes detected. I have seen '-- UU UU UU' sometimes and needed to disconnect power for a cold boot to get it back working.
But I believe that with mux not detected, you won't be able to run the script properly.
I used the MRAA library and wrote some code to pull data from the specified address of my sensor. This seems to have done the trick!
I was able to pull data from the sensor and I am also now able to detect the sensor as well!
However, the script provided in the examples seems to change the configuration such that it doesn't appear anymore:
Do you have any idea why running some code using the MRAA library fixes the issue?
- When using the Arduino IDE, I selected the Intel Edison board.
I'm not sure what might be happening as you can see in section 11.6 of http://download.intel.com/support/edison/sb/edisonarduino_hg_331191007.pdf, the script I shared uses the same commands that are in the hardware guide. My only guess is that you might be using a different image, what is your output when enter the command cat /etc/version.