I2C communication problem

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

I2C communication problem

827 次查看
raduansarif
Contributor I

To check the master & slave I2C communication, I am using MCUxpresso IDE SDK I2C Polling I2C Example. I write the I2C address (for SHTC3 temperature sensor 0x77), transfer (writing) some data to Slave and try to receive that data (read). Master is writing data but can not read it properly. In the polling example, always receiving(read) random data is  0x0. As I am very new in this field I don't understand what's going on, what I need to. How should write the program for appropriately I2C Master & Slave connection? what is necessary information that needs to change for the SDK example? For example subaddress, subaddress size, data, data size, flags. 

My project uses the following equipment:

  1. Project name: Gas detection
  2. MCU: NXP MKL27Z256LH4
  3. IDE: NXP MCUxpresso IDE
  4. Communication interface: I2C
  5. Sensor: SHTC3, BME688, SGP41 and 2/3 gas sensors will be added
  6. Programing language: C
0 项奖励
回复
1 回复

817 次查看
bobpaddock
Senior Contributor III

There are far to many things we don't know about your setup to give good answers.

Is the sensor on the port that the SDK uses in the example?
If not that needs addressed.

Then is the sensors address really 0x77?
The least significant bit of I2C address is reserved for the Read/Write bit.
Could the address be 0xEE?
Some datasheets give the address unshifted and others shifted to account for that low R/W bit.

The MKL27 does have some hardware issues with its I2C module.
The SDA addresses these by adding undocumented NOP instructions.
There are several forum threads about it.
I'd not be concerned if using the SDK code examples.


 

0 项奖励
回复