I2C AXI on PYNQ-Z2 issue

Hello everyone,

I have issues with my board (pynq-z2, image V2.7.0)
I tried to build AXI I2C to connect the inertial module sensor of Sparkfun (LSM6DS0) to the board.
Here are the steps I did:

  1. create the following hardware:
  2. create a bit stream, and upload it to my board with the 3 following files: (.bit, .hwh, .tcl )
  3. writing the following program to communicate with the sensor:

    and the problem is that the tx_data variable is empty and not getting the value I expected from the sensor register at the end of the code.

I tried to understand why this happened, and this is my assumption:

  1. The code runs, the master sends the information to the sensor, and the sensor sends the required information back to the master. But at the end of the transaction, the master pulls up the SDA line (NACK state), resulting in the problem I mentioned.

Here is the information on the sensor address and debug result of the problem:




Does someone know why this happened?
I’m not sure, but maybe there is a problem with the configuration of the AXI I2C block.

Please, any information will help.

Thank you!
Hezi

@hizki33

A simple hardware question, what are the pull-up resistors on the module?
10k above or 5k below?

Hi,
the pull up resistor in the module is 4.7K.

@hizki33

pull up is good.
Try a resister read sweeping from 0x00 to 0xff. Lets see what will happen.

I’m not sure if that’s you meant :


But it behaves the same for the full range : 0x00 - 0xff

@hizki33

https://pynq.readthedocs.io/en/latest/_modules/pynq/lib/iic.html

Can you try use wait rather than sleep?
And sound like the API is a pooling style. Wait between Rd/Wr and see the result?

1 Like

Thank you, for your suggestions for debugging - the issue has been solved!

The wait() function in AxiIIC class was helpful. But the correct place to use it in the code is after the transaction (I tried to place it in between, but it didnt works).
Note : the main issue was the tx_data variable type, I changed it to β€œbytes object” and its finally works.

See correct code that works:


Hezi

2 Likes

@hizki33

Great~
Readme document helps
Enjoy~ =]

Hey i think you need to print the data at each index.
example: tx_data[0], tx_data[1] and so forth