AnsweredAssumed Answered

Help using I2C with PE

Question asked by alexismaslyczyk on Jan 4, 2016
Latest reply on Jan 12, 2016 by alexismaslyczyk

Hi everyone,

I'm trying to use I2C with my IMU MPU6050.

Im' using my MKV58F1M0VLQ22 with KDS 3.1.0 with Processor Expert.

I added my I2C component and configure a master with my SDA SCL pins.

Firstly I would like to receive data from my IMU.

I have to start the I2C first so I think I have to use the function:

i2c_status_t I2C_DRV_MasterInit(uint32_t instance, i2c_master_state_t * master);

But I'm lost, what is the instance and what is The pointer to the I2C master driver state structure.?

 

To get the accelero the register is 0x3B

The adress of my IMU is 0x68

and the size of data is 6 octets

 

To do that I should use

i2c_status_t I2C_DRV_MasterReceiveDataBlocking(uint32_t instance,                                                const i2c_device_t * device,                                                const uint8_t * cmdBuff,                                                uint32_t cmdSize,                                                uint8_t * rxBuff,                                                uint32_t rxSize,                                                uint32_t timeout_ms);

 

but it's the same, what is the instance and the pointer?

cmdBuff is the register 0x3B? so size is 2 ?

rx buff is the adresse of my variable okay and rxSize is 6 I'm right?

And the tileout is a a time defined by me, what is it in general?

 

Thank you  very much

Outcomes