S32k I2C MPU6050

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32k I2C MPU6050

897 Views
fernando_barrio
Contributor III

Hi,

I am familiar programming the NXP S32k144 through the Model-Based Design tool, as we have implemented it on many vehicles in the lab. However, I am having some trouble trying to set up communication using I2C using Design Studio. I have started with the flexio_i2c_s32k144 example project as it seems to be very similar to what I am trying to achieve. I have the clock line set to PTA3 and serial data line set to PTA2. For the MPU6050 sensor, it is an accelorometer/gyro that sends back 16 bits of information. I have tried changing the materbuffer to unint16, besides that the code has been left unchanged. When I debug isTrasnferOk is still [false, false], meaning I am not sending or receiving any data. Please let me know if any of you have any suggestions.

Thank you,

Fernando

Tags (2)
0 Kudos
1 Reply

778 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Fernando,

Could you please scope the I2C bus?
Just to see if the master is sending the correct address etc.

Please refer to the SDK documentation first.
You can find it in the SDK installation folder,
For example:
…/NXP/S32DS_ARM_v2.2/S32DS/software/S32SDK_S32K1xx_RTM_3.0.0/doc/html_S32K144/group__flexio__i2c__drv.html

Or it can be accessed from the S32DS IDE
Left click on a component - > Doxygen Documentation

pastedImage_2.png

The function takes 8bit rxBuff pointer as an argument.

If you want to receive 2 bytes, set rxSize = 2.

pastedImage_4.png

pastedImage_3.png

BTW, you can use the dedicated LPI2C module instead of FlexIO.

Regards,

Daniel

0 Kudos