LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I2C FPGA MPU 9255

I'm trying to read data from a 9255 MPU sensor and all I'm getting are values of 255. What else needs to be done or what am I doing wrong to read data from the sensor?

I am also attaching the entire project.

0 Kudos
Message 1 of 7
(1,739 Views)

What do I need to add so someone can help me? I'm not interested in a ready-made one, but would like to understand what I'm doing wrong. I've read about I2C communication, but so far I haven't come across any materials that would help me answer my questions.

0 Kudos
Message 2 of 7
(1,651 Views)

Well there are a few obvious things.

 

I2C is a bidirectional bus, and to achieve that, the signals are only driven active high or low when the according side is sending data. Have you added proper pull-up resistors on the data line?

 

Do you have a datasheet about the I2C protocol?

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 7
(1,634 Views)

Based on the sensor schematic, I believe the appropriate pull-up resistors are already there. I have the sensor documentation (it's included in the ZIP folder with the project) and there is some description of I2C, but not enough for me.

For example, I also don't know how to set the sensor measurement ranges (e.g. 16g, +-2000deg/s, 15µT/LSB).

 

More about sensor which I'm using you can find here:

10 DOF IMU Sensor (C) - Waveshare Wiki

 

MPU 9255 scheme.png

0 Kudos
Message 4 of 7
(1,630 Views)

I thing I have some clue. I don't knew that the all devices has registers maps. First I must sent address of module, and next right value of register address and I will be able to read the data.
At least I think so.

0 Kudos
Message 5 of 7
(1,597 Views)

Actually, I2C only specifies the "device address" and the data payload specifically. The device address is generally fixed by the chip manufacturer, with sometimes a few external pins to define a few of the 7 to 10 bits of the address to allow having more than one of the same chips on the same bus and an additional bit in the address that encodes if the transfer is a read or write.

 

How the data payload is constructed is up to the device in question. Simple port extenders might for instance not have a register map at all but simply transfer directly the port IO pins in the data section.

 

More complex chips do have an internal register map that first needs to be addressed by a write access to determine which register has to be read or written to by the next bus transfer. To speed this up, I2C also defines a write/read cycle that allows setting the address and then reading the contents in one single bus transfer without the need to do a readdressing in the middle.

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 7
(1,587 Views)

@rolfk wrote:

Actually, I2C only specifies the "device address" and the data payload specifically. The device address is generally fixed by the chip manufacturer, with sometimes a few external pins to define a few of the 7 to 10 bits of the address to allow having more than one of the same chips on the same bus and an additional bit in the address that encodes if the transfer is a read or write.


This I understood. I this case (MPU 9255) I can use two chips on the same line.

 


@rolfk wrote:

How the data payload is constructed is up to the device in question. Simple port extenders might for instance not have a register map at all but simply transfer directly the port IO pins in the data section.


This chip has register map. See attatched pdf file.

 


@rolfk wrote:

More complex chips do have an internal register map that first needs to be addressed by a write access to determine which register has to be read or written to by the next bus transfer. To speed this up, I2C also defines a write/read cycle that allows setting the address and then reading the contents in one single bus transfer without the need to do a readdressing in the middle.


Correct me if I'm not right.

1. First of all I must sent Start bit

2. Next is Devices address+Write bit

3. ACK

4. Some configurations (number register map)

5. ACK

6. Some configurations (number register map)

7. ACK

8. ...

9. ACK

10. Start bit

11. Devices address+Read bit

12. ACK

13. DATA

14. ACK

15. ...

16. NAC

17. Stop bit

0 Kudos
Message 7 of 7
(1,575 Views)