• 0
miguel_rodrigues

Zybo beginner - Simple communication via i2c

Question

Hello everybody,

 

I want to connect my Zybo to a gyroscope that communicates via I2C but I have not been able to do it. I want to do this in bare-metal. What I gathered so far is that I have 2 options:

 

1) connect it directly to the MIO, i.e., to JF PMOD or

2) connect it to another PMOD and from the PL, instantiate an AXI IIC IP and access the values via AXI.

 

Either of the options are fine by me. I have many questions regarding both options. Starting with option 1)

  • Where do I physically connect my gyroscope SCL and SDA lines? Does it depend on the MIO configuration?
  • To which MIO should I assign I2C? Should I use I2C 0 or I2C 1?
  • Which functions are available for reading/writing from/to the I2C interface? Could you provide an example for reading/writing from/to a certain memory position?

And for option 2)

  • Which are the constraints I need to place on the SCL and SDA signals?
  • How to I connect the SCL and SDA signals to the I2C port that is on the AXI IIC IP?
  • Which functions are available for reading/writing from/to the I2C interface? Could you provide an example for reading/writing from/to a certain memory position?

 

I know this may be simple and intuitive but I have not been able to discover it by myself. Thank you very much in advance :)

Best regards,

Miguel

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

 

Miguel Rodrigues,

There is some good documentation here , here for creating the axi IIC. Here is an example of the IP for the PmodAD2 here  that uses IIC.  Here you can download the PmodAD2 example project for the Nexys 3 in VHDL. It uses ISE 13.4 so you would need to do a little modifications to get it working in Vivado. I would use one of the Pmod headers JB- JF.  If you use the reference manual for the PmodAD2 here you see the pinout description table to know how it is connected. Hopefully this helps!

thank you,

Jon

Share this post


Link to post
Share on other sites
  • 0

Hello again. I am still having trouble while using AXI IIC IP (option 2).

 

I think I connected the AXI IIC IP correctly in the PL but I am having trouble in sending the correct programming sequence to my device. I do not want to use interrupts (I want to use polling) and I can not find examples to do this. I want to know which routines to call and in what order to do the following:

 

  • Write 0x00 to register 0x6B of device with ID 0x69
  • while(1) Read 14 bytes, beginning in register 0x3B of device with ID 0x69

 

Thanks in advance :)

Share this post


Link to post
Share on other sites
  • 0

Hi Miguel,

You can use the IP that i posted earlier for the PmodAD2. In the PmodAD2.c here  you can use the AD2_ReadIIC and  AD2_WriteIIC functions in you main instead. Hopefully this helps!

cheers,

Jon

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now