UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor
Contributor
4,440 Views
Registered: ‎02-27-2014

How to address registers of IIC devices?

Jump to solution

Hello, everyone.

I am trying to use some IIC devices (gyro, accelerometer and et al.) mounted to IIC controllers of Zynq. I have known that the slave address (7 bits) of devices should be written to I2C_address_reg0. But how to address registers of IIC devices? It seems that the technical reference manual do not mention it. I guess that both the data and register addresses should be written to I2C_data_reg0. But the technical reference manual do not mention details either.

Can anybody give me some advices or references?

Thanks very much.

0 Kudos
1 Solution

Accepted Solutions
Teacher muzaffer
Teacher
7,573 Views
Registered: ‎03-31-2012

Re: How to address registers of IIC devices?

Jump to solution

I don't know which device you are using so take this device http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00091417.pdf as an example.

 

The information you want is in section 5.1.1 page 23/48. It says: "The I2C embedded inside the LIS3LV02DL behaves like a slave device and the following protocol must be adhered to. After the start condition (ST) a salve address is sent, once a slave acknowledge (SAK) has been returned, a 8-bit sub-address will be transmitted: the 7 LSb represent the actual register address while the MSB enables address auto increment. If the MSb of the SUB field is 1, the SUB (register address) will be automatically incremented to allow multiple data read/write."
This is quite common as there is not much else which can be done. The master writes the slave address in the first byte and the register address in the second byte with some minor differences.

From the zynq point of view anything which goes on in the second byte (and further bytes) of the i2c frame is data so this means you need to put the register address and the actual data to send in the correct required order by your device into the data register.

- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.

View solution in original post

0 Kudos
1 Reply
Teacher muzaffer
Teacher
7,574 Views
Registered: ‎03-31-2012

Re: How to address registers of IIC devices?

Jump to solution

I don't know which device you are using so take this device http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00091417.pdf as an example.

 

The information you want is in section 5.1.1 page 23/48. It says: "The I2C embedded inside the LIS3LV02DL behaves like a slave device and the following protocol must be adhered to. After the start condition (ST) a salve address is sent, once a slave acknowledge (SAK) has been returned, a 8-bit sub-address will be transmitted: the 7 LSb represent the actual register address while the MSB enables address auto increment. If the MSb of the SUB field is 1, the SUB (register address) will be automatically incremented to allow multiple data read/write."
This is quite common as there is not much else which can be done. The master writes the slave address in the first byte and the register address in the second byte with some minor differences.

From the zynq point of view anything which goes on in the second byte (and further bytes) of the i2c frame is data so this means you need to put the register address and the actual data to send in the correct required order by your device into the data register.

- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.

View solution in original post

0 Kudos