S32k I2C MPU6050

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S32k I2C MPU6050

1,153 次查看
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

标记 (2)
0 项奖励
回复
1 回复

1,034 次查看
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 项奖励
回复