Community
cancel
Showing results for 
Search instead for 
Did you mean: 
idata
Community Manager
2,256 Views

i2c on Edison

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 https://www.sparkfun.com/products/13034 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

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

0 Kudos
22 Replies
idata
Community Manager
60 Views

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
idata
Community Manager
60 Views

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

idata
Community Manager
60 Views

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?

idata
Community Manager
60 Views

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
idata
Community Manager
60 Views

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

idata
Community Manager
60 Views

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
idata
Community Manager
60 Views

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 https://www.sparkfun.com/products/13034 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/ 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

idata
Community Manager
60 Views

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
idata
Community Manager
60 Views

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

idata
Community Manager
60 Views

HI Leonardo,

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

Thank you

Paul

idata
Community Manager
60 Views

Hi Paul_B,

 

 

We don't have any list like that, I think that the only document related to this is the http://www.intel.com/content/www/us/en/support/boards-and-kits/000020775.html 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
idata
Community Manager
60 Views

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

idata
Community Manager
60 Views

Hi Paul_B,

 

 

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

 

 

I appreciate your patience.

 

 

Regards,

 

-Leonardo

 

idata
Community Manager
60 Views

Thank you Leonardo for your help.

Best

Paul

idata
Community Manager
60 Views

Hi Paul_B,

 

 

I was researching about this, and I found that there isn't a team to help you. We provide the information about the Edison board to the users to start projects like this one, all the I2C specifications of the Edison can be found on hardware guides.

 

 

So, I encourage you to try to integrate this new sensor using the documentation mentioned before.

 

 

Feel free to share your results here to help the community.

 

 

Regards,

 

-Leonardo
idata
Community Manager
60 Views

Ok, even if it is for business ? for an objectiv of 100 000 units?

Anyway, I seems that this is a voltage issue of the i2c that nobody arrived to solve.

Could you send me the link of the hardware i2c constraints, I will watch out the signal with an oscillo and come back to you.

Best

Paul

idata
Community Manager
60 Views

Hi Paul,

 

 

Well there isn't such team to help with your request, all the Edison I2C information available that you can find is in the http://http://www.intel.com/content/www/us/en/support/boards-and-kits/000005808.html Intel® Edison Compute Module Hardware Guide (Section 4.2), and you can also find helpful information in the http://www.intel.com/content/www/us/en/support/boards-and-kits/000005583.html Intel® Edison Kit for Arduino Hardware Guide and the http://www.intel.com/content/www/us/en/support/boards-and-kits/000005574.html Intel® Edison Breakout Board Hardware Guide.

 

 

I hope you find this information helpful.

 

 

Regards,

 

-Leonardo
idata
Community Manager
60 Views

Hi Leonardo,

Do you know if this issues has been fixed ?

Do you know if there is a list of other I2C knwon issues to go faster to understand what is wrong with the communication..

Thank you

Paul

idata
Community Manager
60 Views

Hi Paul_B,

 

 

If you check the changelog of MRAA https://github.com/intel-iot-devkit/mraa/blob/master/docs/changelog.md, there have been a lot of changes of the I2C from the version 1.0.0 of this library, so maybe it is fixed. You can try it, but if you still have issues with it I recommend you to contact MRAA for a better support.

 

 

About the list of known issues, as far as I know there isn't a list, but it is a good idea to have one. I will pass this feedback to the right team to consider it.

 

 

Thanks for the post.

 

 

Have a nice day.

 

 

Regards,

 

-Leonardo