Has anybody succesfully used the i2c lib (lib_i2c - 3.1.1)

If you have a simple question and just want an answer.
IgorLopez
Member++
Posts: 25
Joined: Tue Mar 11, 2014 8:16 pm

Has anybody succesfully used the i2c lib (lib_i2c - 3.1.1)

Post by IgorLopez »

Hi,I am trying to talk to my startkit from a raspberry PI with a very simple example where the startkit is set up as a I2C slave.When running: sudo i2cdetect -y 1from the raspberry I get no acknowledge from the startkit on bit 9 but the display(also added to the raspberry PI) does acknowledge.I have set my startkit to have address 0x21 whereas the display is on 0x20 and I will make proper oscilloscopes recording of the SDA/SCL pins to compare the different slaves responses as soon I get hands on a good DSO.In order to understand the lib better I made a simple xcore application with one master and one slave so I could use my picoscope to measure what happens on the pins when sending know data from master to slave. This time I had to add pullup resistors to 3.3V to the lines since the raspberry PI was not connected. The measured signals did not match what I expected and I might be using the lib wrongly.I have attached my simple Master/Slave example together with a Calc file with pictures of the signals for different data payloads if anybody is interested.Note, the upload mechanism renamed the file from MasterSlaveTest.tar.gz to MasterSlaveTest.tar_.gz for security reasons and I could only attach one file to the post so I packed them. The md5 checksum of the file should be: 7f3df609d9b51762b2ebd71f1c26ade7
You do not have the required permissions to view the files attached to this post.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

Hi Igor. What is the behaviour at slower I2C bus speeds ? Try 10khz as an example (rather than 100khz) to validate the code.

As a few general comments I would suggest:

a) to add some debug code to be more verbose on each of the I2C states to understand where is the fault in the logic flow

b) Does your picoscope tool offer an I2C bus analyzer module ? Do you have a tool such as the Total Phase Aardvark / Beagle ? Consider to use another I2C master to verify your slave code although one of engineers here is using the Raspberry PI for assorted experiments with an external I2C LCD display so should be also fine as a master. However perhaps our Raspberry PI board is the earlier release but recall him noting some SMD resistors that needed to be modded (0402 size ?) - which we removed with our hot air tool - cannot recall the full details at this time.

c) Consider to review the following working I2C example and I2C Library user guide which offer additional details on how to use the library:

http://www.xcore.com/projects/io-port-expander-mcp23017

https://www.xmos.com/download/private/l ... .0rc1).pdf

If the above does not resolve the quirk, write back and can attempt to emulate your setup and review against our I2C bus analyzer tools to compare notes.