1 2 Previous Next 22 Replies Latest reply on Jan 11, 2017 1:28 PM by Intel Corporation

    i2c on Edison

    Paul_B

      Hi Intel Team,

       

      I am trying to configure i2c for python/golang on my Edison + Breakout Arduino + BaseShield v2 with my own sensor which works perfectly on Raspberry Pi.

       

      In order to test it

      TEST 1/

      I first use a Groove LCD to test the communication and with i2cdetect i did not find any devices.

       

      root@MytestBoard:~# 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: -- -- -- -- -- -- -- --

      root@MytestBoard:~# i2cdetect -y -r 6

           0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

      00:          -- -- -- -- -- -- -- -- -- -- -- -- --

      10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

      20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

      30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

      40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

      50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

      60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

      70: -- -- -- -- -- -- -- --

       

       

      BUT I can control It.. with mraa/examples/python# python rgblcd.py

      and the LCD change color.

      The code=>

      "

      import mraa

      import time

       

       

      # This example will change the LCD backlight on the Grove-LCD RGB backlight

      # to a nice shade of purple

      x = mraa.I2c(0)

      x.address(0x62)

       

       

      # initialise device

      x.writeReg(0, 0)

      x.writeReg(1, 0)

       

       

      # sent RGB color data

      x.writeReg(0x08, 0xAA)

      x.writeReg(0x04, 255)

      x.writeReg(0x02, 255)

      x.writeReg(0x03, 0)

      "

      And I own sensor does not appear either and i did not know if it is an hardware issue or software issue

       

      TEST 2/

      I have plug my sensor on an other board with i2c adpator SparkFun Block for Intel® Edison - I2C - DEV-13034 - SparkFun Electronics

      and I saw ym sensor:

      root@MytestBoard2:~# i2cdetect -r -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: -- -- -- -- 74 -- -- --

       

      If I try to communicate with the board, I get some errors and not answer from my sensor.

       

      root@MytestBoard2:~# python test2-intel.py

      Start

       

      0

       

      1

       

      2

       

      3

       

      4

      Traceback (most recent call last):

        File "test2.py", line 29, in <module>

        val = x.read(2)

        File "/usr/lib/python2.7/site-packages/mraa.py", line 1164, in read

        return _mraa.I2c_read(self, data)

      IOError: [Errno 11] Resource temporarily unavailable

       

      See programm attached.

       

      @Intel Team

      Do you know why there i2c tools do not detect devices/sensors on arduino breakoutboard?

      Do you why i get this "Resource temporarily unavailable" when reading device info?

      Do you have an example of a read i2c value in python for i2c. (equivalent of smbus.read_byte(adress) and smbus.write_i2c_block_data() in mraa)

       

      Thank you

        • 1. Re: i2c on Edison
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi Paul_B,

          Thank you for contacting us.

          Well that's weird. About the I2Cdetect I have seen that too, I'm not sure why this happens, sometimes it is a power issue. 

          Regarding the error "Resource temporarily unavailable", I have never seen it but it looks like that the resource is busy and you can't access to it.

          And we don't have examples about it, but you can check the python API (http://iotdk.intel.com/docs/master/mraa/python/mraa.html#i2c), and you can also check in the UPM repository examples for I2C sensors (https://github.com/intel-iot-devkit/upm/tree/master/examples/python).

          I hope you find this information helpful.

          Regards,
          -Leonardo

          • 2. Re: i2c on Edison
            Paul_B

            Hi Leonardo,

             

            You answer did not help me..as I did already look it these direction.

             

            Do you think that one of these orginal services could create issue? And Is there a clean way to stop all this useless services to try to find the issue?

             

            137 root      9448 S    /lib/systemd/systemd-udevd

              162 root         0 SW<  [ext4-dio-unwrit]

              164 systemd- 12092 S    /lib/systemd/systemd-timesyncd

              186 root         0 SW   [jbd2/mmcblk0p10]

              187 root         0 SW<  [ext4-dio-unwrit]

              192 root      1728 S    /usr/bin/pwr_button_handler /bin/systemctl start blink-led sh -c "/bin/systemctl stop blink-led && /usr/bin/configu

              194 root      6380 S    /usr/sbin/wpa_supplicant -u -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -Dnl80211 -puse_p2p_group_interface=1

              199 root      2744 S    /usr/sbin/crond -n

              200 root      5128 S    /usr/sbin/ofonod -n

              207 root      3228 S    /usr/sbin/bluetooth_rfkill_event

              208 root      3128 S    {launcher.sh} /bin/sh /opt/edison/launcher.sh

              209 root      1920 S    /opt/edison/clloader --escape --binary --zmodem --disable-timeouts

              217 root      2836 S    /lib/systemd/systemd-logind

              219 messageb  2892 S    /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation

              223 root      2648 S    /lib/systemd/systemd-networkd

              224 root      2364 S    /usr/bin/watchdog-sample 30

              244 root      4684 S    /usr/lib/bluez5/bluetooth/bluetoothd -E

              248 root      2128 S    /sbin/agetty -8 --keep-baud ttyMFD2 115200 xterm

              249 root      2128 S    /sbin/agetty --noclear tty1 linux

              250 pulse     109m S <  /usr/bin/pulseaudio --system --resample-method=src-sinc-fastest

              273 root      1924 S    /usr/sbin/wpa_cli -a /etc/wpa_supplicant/wpa_cli-actions.sh -i p2p-dev-wlan0

              275 root      2372 S    /lib/systemd/systemd-hostnamed

              280 root      2116 S    /lib/systemd/systemd-resolved

              282 root      4536 S    /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

              285 nobody    2616 S    /usr/sbin/mdnsd

              287 root      3132 S    {xdk-daemon} /bin/sh /opt/xdk-daemon/xdk-daemon

              292 root     76996 S    /usr/bin/node /opt/xdk-daemon/main.js

              306 root      1924 S    /usr/sbin/wpa_cli -a /etc/wpa_supplicant/wpa_cli-actions.sh -i wlan0

              323 root      111m S    /usr/bin/node /opt/xdk-daemon/current/appDaemon.js

              324 root         0 SW<  [loop0]

              341 root     19896 S    /usr/bin/redis-server /etc/redis/redis.conf

              380 root      2652 S    udhcpc -i wlan0 -p /var/run/udhcpc-wlan0.pid -S

              381 root      5120 R    sshd: root@pts/0

              383 root      3260 S    -sh

              404 root         0 SW   [kworker/0:0]

              454 root         0 SW   [kworker/0:2]

              458 root      2892 R    ps

            • 3. Re: i2c on Edison
              Paul_B

              In addition, I have found this issue that has never been solved on the forum.

               

              [ 8793.936646] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration

               

              I am working with 3.3V I2C device which work perfectly  with Raspi.

               

              Anymore idear to correct this?

              • 4. Re: i2c on Edison
                Intel Corporation
                This message was posted on behalf of Intel Corporation

                Hi Paul_B,

                I tried to replicate the error and I couldn't do it. Your code ran without problems. I don't know why you are getting issues with it and I don't think that it is a problem with the services.

                I recommend you to flash the latest image in your Edison and give it a try. https://software.intel.com/en-us/iot/hardware/edison/downloads.

                Let me know if you still have issues.

                Regards,
                -Leonardo

                • 5. Re: i2c on Edison
                  Paul_B

                  Hi Leonardo,

                   

                  I already have the last version installed.

                   

                  Could you tell me how you exactly test, to try to start from it? or which i2c sensor you use to compare .

                   

                  Looking forward,

                   

                  Best,

                   

                  Paul

                  • 6. Re: i2c on Edison
                    Intel Corporation
                    This message was posted on behalf of Intel Corporation

                    Hi Paul_B,

                    Well, this is what I did:

                    1- I flashed the Edison with the latest image.

                    2- I updated UPM and MRAA libraries.

                    3. I connected a LCD display that we have and I ran the i2cdetect command to see the address.

                    4. I ran your code with the LCD address without problems.

                    5. I also tried to run your code on background and I ran the i2cdetect command too, to see if it crashes but it didn't.

                    I didn't have issues at all with those steps so that's why I recommended to you to flash the Image again.

                    I will be waiting for your response.

                    Regards,
                    -Leonardo

                    • 7. Re: i2c on Edison
                      Paul_B

                      Thank you Léonardo for your answer.

                       

                      In fact I did not have any issues either if I connect a Groove LCD Module.

                       

                      I do extra tests to see what's wrong.

                       

                      1/ I connect my sensor chip directly to i2c output of SparkFun Block for Intel® Edison - I2C - DEV-13034 - SparkFun Electronics

                      When i do i2cdetect i found the chip and get no error.

                      But if I do an i2cset or i2cget, I get an error:

                      [  988.224841] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration

                       

                      2/ I put a i2c isolation barrier (http://fr.rs-online.com/web/p/isolateurs-numeriques/8253075/) between the chip sensor and the sparkfun i2c module,

                      i2cdetect did not find any device and i get the following error again

                      [  988.224841] i2c-designware-pci 0000:00:08.0: i2c_dw_handle_tx_abort: lost arbitration

                       

                      (Note: that i tried why raspberry pi and get any issue with the two configuration)

                       

                      3. Then i try to change the speed from fast to std by doing this

                      echo std > /sys/devices/pci0000:00/0000:00:08.0/i2c_dw_sysnode/mode

                       

                      but i did not get more return from the chip with the two configuration.

                       

                       

                      => I saw on the intel forum that this error could lead from an non compatibility with intel products and as I need to make this works I would like to know if you could give us i2c isolation barrier that works with edison or how we could do this communication.

                       

                      Thank for your help

                       

                      Best

                       

                      Paul

                      • 8. Re: i2c on Edison
                        Intel Corporation
                        This message was posted on behalf of Intel Corporation

                        Hi Paul_B,

                        Yes, I have seen that too, sometimes the error is a non-compatibility of the device with our platforms. As far as we know there isn't an I2C isolation barrier verified to work with Edison or a workaround to avoid this issue, sometimes the error is just an issue powering the I2C device directly from the Edison, in those cases you have to power the device externally.

                        There have been issues related to I2C where the root cause is the power source used, or in some other cases the buffer or voltage translators. There are several threads on this I2C issues.

                        Have a nice day.

                        Regards,
                        -Leonardo

                        • 9. Re: i2c on Edison
                          Paul_B

                          Hi Leonardo,

                           

                          Do you have a list of tests that we could do to enable the communication as we want to commercialized our sensor that works on Pi.

                           

                          Or is there a way to send our board to enable compatibility ?

                           

                          Thank for time and your return,

                          Best

                          Paul

                          • 10. Re: i2c on Edison
                            Paul_B

                            HI Leonardo,

                             

                            In addition is there board which has been uncompatible even after modification and tests?

                             

                            Thank you

                             

                            Paul

                            • 11. Re: i2c on Edison
                              Intel Corporation
                              This message was posted on behalf of Intel Corporation

                              Hi Paul_B,

                              We don't have any list like that, I think that the only document related to this is the Shield Testing Report for Intel® Galileo Board, Intel® Galileo Gen 2 Board, and Intel® Edison Board.

                              I gave you all the possible recommendations to this issue, sometimes when they don't work is because the non-compatibility is just a hardware limitation.

                              Regards,
                              -Leonardo

                              • 12. Re: i2c on Edison
                                Paul_B

                                Hi Leonardo,

                                 

                                My question is just to know if there is a way to work with Intel to integrate a "new sensor" to this validated sensors list like a dedicaded team.

                                 

                                Or the answer is do it yourself?

                                 

                                Thank you

                                 

                                Paul

                                • 13. Re: i2c on Edison
                                  Intel Corporation
                                  This message was posted on behalf of Intel Corporation

                                  Hi Paul_B,

                                  Let me investigate more about it, I'll let you know when I have updates.

                                  I appreciate your patience.

                                  Regards,
                                  -Leonardo
                                   

                                  • 14. Re: i2c on Edison
                                    Paul_B

                                    Thank you Leonardo for your help.

                                     

                                    Best

                                     

                                    Paul

                                    1 2 Previous Next