Community
cancel
Showing results for 
Search instead for 
Did you mean: 
KKost5
Novice
2,893 Views

i2c for Edison Arduino Board how it work?

Hello,

I some days try to connect a lot of i2c devices to Edison + Arduino board but cann't understand how it works?!?!

 

Firstly I try connect Sparkfun TMP102, after Lidar-Light and now Grove-LCD RGB module.

As I read Edison Arduino Board provide connection to I2CBUS = 6

 

I try to `i2cdetect -y -r 6` comand but it return a lot of errors(Edison firmware version 159.devkit)

 

I try a lot of python examples but anyone does not work.

 

And finaly I try to connect LCD and python example with UPM - its work!!! But if i try to execute i2cdetect during executing LCD example both programs crached.

 

Anyone can me explain - what am I doing wrong? how it must work?

9 Replies
Carlos_M_Intel
Employee
49 Views

Hi kkostyuk,

When you run the example and i2cdetect, do you receive an error message or the board just stops working? If there is an error message, could you send a screenshot of it?

Have you tried to check the signals that they are of 5V and that there isn't noise in them?

Why are you trying to use i2cdetect while running the other code? The problem could be a conflict in the request of the bus.

Also, check the state of the pull-up resistors http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonarduino_hg_331191007.pdf Edison + Arduino Expansion Board. Hardware Guide[Section 11.6]

Regards,

Charlie

KKost5
Novice
49 Views

Hello,

 

Create shel script from section 11.6 and execute without any error. https://github.com/KonstantinKostyuk/edison-i2c-tests GitHub with files.

 

Try i2cdetect

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

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

But at the same time connected 2 i2c device adreses(0x3E, 0x62) of Grove-LCD.

Start execute UPM example for LCD - it work, and execute i2cdetect 

Error on 0x3E position and on 0x62.

A long error mesage:

root@PCR2016:~# python lcd/lcd.py &

[1] 352

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

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

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

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

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

30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- [ 59.111656] i2c-designware-pci 0000:00:09.1: i2c_dw_handle_tx_abort: lost arbitration

-- [ 62.118070] i2c-designware-pci 0000:00:09.1: ===== REGISTER DUMP (i2c) =====

[ 62.118165] i2c-designware-pci 0000:00:09.1: DW_IC_CON: 0x65

[ 62.118238] i2c-designware-pci 0000:00:09.1: DW_IC_TAR: 0x3f

[ 62.118307] i2c-designware-pci 0000:00:09.1: DW_IC_SS_SCL_HCNT: 0x2f8

[ 62.118376] i2c-designware-pci 0000:00:09.1: DW_IC_SS_SCL_LCNT: 0x37b

[ 62.118446] i2c-designware-pci 0000:00:09.1: DW_IC_FS_SCL_HCNT: 0x87

[ 62.118515] i2c-designware-pci 0000:00:09.1: DW_IC_FS_SCL_LCNT: 0x10a

[ 62.118584] i2c-designware-pci 0000:00:09.1: DW_IC_INTR_STAT: 0x0

[ 62.118652] i2c-designware-pci 0000:00:09.1: DW_IC_INTR_MASK: 0x246

[ 62.118721] i2c-designware-pci 0000:00:09.1: DW_IC_RAW_INTR_STAT: 0x10

[ 62.118790] i2c-designware-pci 0000:00:09.1: DW_IC_RX_TL: 0x20

[ 62.118858] i2c-designware-pci 0000:00:09.1: DW_IC_TX_TL: 0x20

[ 62.118927] i2c-designware-pci 0000:00:09.1: DW_IC_ENABLE: 0x1

[ 62.118995] i2c-designware-pci 0000:00:09.1: DW_IC_STATUS: 0x2

[ 62.119062] i2c-designware-pci 0000:00:09.1: DW_IC_TXFLR: 0x1

[ 62.119130] i2c-designware-pci 0000:00:09.1: DW_IC_RXFLR: 0x0

[ 62.119198] i2c-designware-pci 0000:00:09.1: DW_IC_TX_ABRT_SOURCE: 0x0

[ 62.119265] i2c-designware-pci 0000:00:09.1: DW_IC_DATA_CMD: 0x0

[ 62.119332] i2c-designware-pci 0000:00:09.1: ===============================

[ 62.119432] CPU: 0 PID: 358 Comm: i2cdetect Tainted: G W O 3.10.17-poky-edison+ # 1

[ 62.119437] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48

[ 62.119444] task: f547f4d0 ti: f54b4000 task.ti: f54b4000

[ 62.119506] Stack:

[ 62.119574] Call Trace:

[ 62.119993] Code: e8 2f 59 6b 00 8b 15 c0 6c bd c1 b8 02 00 00 00 ff 52 7c eb 0f b8 58 89 41 00 e8 c8 65 2b 00 83 eb 01 74 09 f6 05 00 7b c7 c1 03 <75> e8 f0 80 25 f4 f3 d1 c1 fe eb ab 8b 15 c0 6c bd c1 55 b8 20

[ 62.120017] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G W O 3.10.17-poky-edison+ # 1

[ 62.120022] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48

[ 62.120031] task: f6c83d30 ti: f6e1e000 task.ti: f6e1e000

[ 62.120093] Stack:

[ 62.120162] Call Trace:

[ 62.120370] Code: 50 08 83 e2 08 75 39 31 d2 83 c0 08 89 d1 0f 01 c8 0f ae f0 89 f6 89 e0 25 00 e0 ff ff 8b 40 08 a8 08 75 07 b1 01 89 f0 0f 01 c9 <85> 1d 78 60 c1 c1 75 0d 8d 55 f0 b8 05 00 00 00 e8 47 1a d7 ff

[ 62.121003] i2c-6: recovery ignore

--

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

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

60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- [ 65.827419] i2c-designware-pci 0000:00:09.1: ===== REGISTER DUMP (i2c) =====

[ 65.827516] i2c-designware-pci 0000:00:09.1: DW_IC_CON: 0x65

[ 65.827595] i2c-designware-pci 0000:00:09.1: DW_IC_TAR: 0x6e

[ 65.827671] i2c-designware-pci 0000:00:09.1: DW_IC_SS_SCL_HCNT: 0x2f8

[ 65.827747] i2c-designware-pci 0000:00:09.1: DW_IC_SS_SCL_LCNT: 0x37b

[ 65.827823] i2c-designware-pci 0000:00:09.1: DW_IC_FS_SCL_HCNT: 0x87

[ 65.827898] i2c-designware-pci 0000:00:09.1: DW_IC_FS_SCL_LCNT: 0x10a

[ 65.827973] i2c-designware-pci 0000:00:09.1: DW_IC_INTR_STAT: 0x0

[ 65.828048] i2c-designware-pci 0000:00:09.1: DW_IC_INTR_MASK: 0x246

[ 65.828123] i2c-designware-pci 0000:00:09.1: DW_IC_RAW_INTR_STAT: 0x10

[ 65.828198] i2c-designware-pci 0000:00:09.1: DW_IC_RX_TL: 0x20

[ 65.828273] i2c-designware-pci 0000:00:09.1: DW_IC_TX_TL: 0x20

[ 65.828348] i2c-designware-pci 0000:00:09.1: DW_IC_ENABLE: 0x1

[ 65.828422] i2c-designware-pci 0000:00:09.1: DW_IC_STATUS: 0x2

[ 65.828496] i2c-designware-pci 0000:00:09.1: DW_IC_TXFLR: 0x1

[ 65.828570] i2c-designware-pci 0000:00:09.1: DW_IC_RXFLR: 0x0

[ 65.828644] i2c-designware-pci 0000:00:09.1: DW_IC_TX_ABRT_SOURCE: 0x0

[ 65.828718] i2c-designware-pci 0000:00:09.1: DW_IC_DATA_CMD: 0x0

[ 65.828791] i2c-designware-pci 0000:00:09.1: ===============================

[ 65.828898] CPU: 0 PID: 358 Comm: i2cdetect Tainted: G W O 3.10.17-poky-edison+ # 1

[ 65.828904] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48

[ 65.828911] task: f547f4d0 ti: f54b4000 task.ti: f54b4000

[ 65.828974] Stack:

[ 65.829043] Call Trace:

[ 65.829472] Code: 10 b3 ff ff 89 f8 09 d0 80 ce 04 83 ff 02 0f 45 d0 a1 94 72 bd c1 89 90 00 b3 ff ff f7 c6 00 02 00 00 74 15 e8 20 58 0b 00 56 9d <83> c4 04 5b 5e 5f 5d c3 8d b6 00 00 00 00 56 9d e8 39 5b 0b 00

[ 65.829497] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G W O 3.10.17-poky-edison+ # 1

[ 65.829502] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48

[ 65.829510] task: f6c83d30 ti: f6e1e000 task.ti: f6e1e000

[ 65.829573] Stack:

[ 65.82964...

KKost5
Novice
49 Views

One more point. About hardware.

  • Edison
  • Arduino board from Intel
  • Grove Base shield(3v3_vcc_5v set to 5v) from Intel IoT Start-kit
  • Grove -LCD RGB from Intel IoT Start-kit
Carlos_M_Intel
Employee
49 Views

Hi kkostyuk,

I used your configuration with 159.devkit and 146 versions and had the same output.

Once you run the code lcd.py it seems that mraa changes the I2C configuration, one thing you could try is to re-install or update the i2ctools in the board.

Is the UPM code working fine for you?

Regards,

Charlie

KKost5
Novice
49 Views

Hello,

I remove and install i2c-tools and i2c-tools-misc. Upgrede mraa and upm.

 

No any changes, behevior the same.

I make some experiments and found mraa are makes additional changes from the section 11.6

First

  1. execute i2c_mux.sh. No any error.
  2. execute i2cdetect -y -r 6. No any adreses detected but LCD(0x3E, 0x62) connected.
  3. execute lcd.py. No any error, LCD show messages and change colors.
  4. execute i2cdetect -y -r 6. Crashed on adreses 0x3E and 0x62.

Second

  1. execute i2cdetect -y -r 6. Crashed on first adres.
  2. execute lcd.py. No any error, LCD show messages and change colors.
  3. execute i2cdetect -y -r 6. Crashed on adreses 0x3E and 0x62.

Script and python example available on https://github.com/KonstantinKostyuk/edison-i2c-tests GitHub with files.

UPM example work fine, but i have some modules wthout UPM libs and I would like connect them via python+mraa.

For this connection I have not got understanding how it work!

 

I conect this modules to RasPi without any problem.
KKost5
Novice
49 Views

One more experement

  1. Detach Grove-LCD(0x3E, 0x62)
  2. Atach Lidar-Light(0x62)
  3. execute i2c_mux.sh. No any error.
  4. execute i2cdetect -y -r 6. No any adreses detected. Lidar-Light(0x62) connected.
  5. execute lcd.py. Have error no LCD device.
  6. execute i2cdetect -y -r 6. No carshes and see 0x62 adress.

 

root@PCR2016:~# ./i2c_mux.sh

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

 

root@PCR2016:~# python lcd/lcd.py

Traceback (most recent call last):

File "lcd/lcd.py", line 8, in

lcd = pyupm_i2clcd.Jhd1313m1(I2CBUS, 0x3E, 0x62)

File "/usr/lib/python2.7/site-packages/pyupm_i2clcd.py", line 532, in __init__

this = _pyupm_i2clcd.new_Jhd1313m1(bus, lcdAddress, rgbAddress)

RuntimeError: UPM Runtime Error: upm::Jhd1313m1::Jhd1313m1(int, int, int): Unable to initialise the LCD controller

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

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

root@PCR2016:~# i2cdump -y 6 0x62

No size specified (using byte-data access)

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

00: 00 27 80 51 80 78 04 f9 86 ff 0d 34 e5 67 bd 00 .'?Q?x???.?4?g?.

10: c0 ad 00 00 00 bf 18 22 43 02 30 00 00 00 00 00 ??...??"C?0.....

20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

40: 00 14 00 00 00 00 00 24 00 9a 00 00 34 00 00 06 .?.....$.?..4..?

50: 00 00 00 00 00 00 1e 0d 34 e5 67 bd 00 00 00 6d ......??4?g?...m

60: 14 00 70 53 d8 00 00 00 00 00 00 00 00 00 00 00 ?.pS?...........

70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

80: 00 27 80 51 80 78 04 f9 86 ff 0d 34 e5 67 bd 00 .'?Q?x???.?4?g?.

90: c0 ad 00 00 00 bf 18 22 43 02 30 02 00 00 00 00 ??...??"C?0?....

a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

c0: 00 14 00 00 00 00 00 24 00 74 00 00 34 00 00 06 .?.....$.t..4..?

d0: 00 00 00 00 00 00 1e 0d 34 e5 67 bd 00 00 00 6d ......??4?g?...m

e0: 14 00 70 53 d8 00 00 00 00 00 00 00 00 00 00 00 ?.pS?...........

f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

Carlos_M_Intel
Employee
49 Views

Hi kkostyuk,

Yes, MRAA does changes in order to be able to run the different functions. If you want to use python + I2C you can use the MRAA library and create your own classes or your code according to the requirements of the project.

You can also try with smbus for python.

Regarding to the problems with i2cdetect and the Lidar-Light, are you using the correct voltages to power the device? Does it use 3.3V or 5V?

Also, have you tried to use a logic analyzer to check the signals on the bus?

Does this shield also use the 0x3E and 0x62 addresses?

Regards,

Charlie

KKost5
Novice
49 Views

Sorry for long delay.

 

Unfortunately i have not got a lot of times for investigation of crude product.

 

I connect lidar and other i2c modules to RasPi and happy.

My small opinion, please add function of Init and Mux of pins to edison_config.sh

KKost5
Novice
49 Views

After installing version 3.0 I connect to Lidar and read distance data by i2c-utils and python(mraa) code.