This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Attempting I2C + MPU6050, need advice

Other Parts Discussed in Thread: TMS320F28035

I am attempting to use an MPU-6050 connected to a TMS320F28035 Experimenter kit. I loaded the I2C_eeprom example into CCS5, and the first thing I noticed is that it is far more complex (>400 loc) than the relatively easy  SPI (139 loc), Serial (150 loc), and CAN (250 loc) examples. I'm a hardware guy, and not much of a programmer, so I usually have to modify the functions from the examples to get my designs to work. This example is far too complex for me for figure out or use.

So before I spend too much more time on this, I would appreciate some advice from people who are more experienced with this sort of thing:

Is I2C a bad design choice? It looks so complicated that it could only have originated in the 1980's. Is no one using it anymore in favor of SPI? Should I redesign using a sensor that has a SPI port exposed (the sparkfun MPU6050 breakout does not).

Is this problem already 'solved'? Linux has really easy ways to read I2C sensors like ioctl or i2cget. Has someone written a simple function that a "hardware guy" could use? It would like this:

uint16 ReadI2C(uint16 address, uint16 register){

//returns whatever is in the register in the device at the address

...400 loc goes here.

magic statemachine, timing, rules, flags, interrupts and stuff

}

  • I should clarify the technical issue: having read the I2c spec and data manual for the MPU6050, I know EXACTLY what I want to send. I want to put 11010001 into a shift register, shift it out, wait for ACK, send 8 bit address, wait for ACK, clock 8 cycles to read whats in the register, then send NACK.

    Does the TMS320 expose direct control of the R/W or the ACK/NACK bits? Right now it sends a write bit and a NACK *every time*, so the MPU6050 never talks back or sends data.