I2C example for InternalI2C component

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

I2C example for InternalI2C component

ソリューションへジャンプ
3,642件の閲覧回数
ky3orr
Contributor II

Hello All,

 

I am struggling with getting an I2C communication to work with use InternalI2C component and KL05 MCU.

My tools are KDS 1.1.1 with Processor Expert Software - Update for KDS v1.1.x.

 

I am not using any OS and trying to communicate (in main) with outside BMP180 pressure sensor using interrupt examples from component's help.

It seems that events are not triggered after I do SendBlock().

 

  I2C_SelectSlave(SLAVE_ADDR);

 

  while(TRUE) {

      i2cErr = I2C_SendBlock(READ_ID, 1U, &i2cRet);

      while(!i2cTxFlag);

      i2cTxFlag = 0;

      i2cErr = I2C_RecvBlock(i2cData, 1U, &i2cRet);

      while(!i2cRxFlag);

      i2cRxFlag = 0;

  }

 

Does anybody have any working example on how to use I2C when I need to send a register read request and read back one byte of data?

 

And by the way - for mentioned component slave device address is to be set as 7-bit value, so if my BMP180 sensor is told to have 0xEE address for reading and 0xEF for writing what should I pass to the SelectSlave() routine? 0x77?

 

thanks for help.

 

best regards

ラベル(1)
タグ(2)
0 件の賞賛
返信
1 解決策
1,194件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

hello Grzegorz,

as i know Freescale doesn't have I2C pe demo code under KDS.

I suggest you refer according I2C processor expert sample code under CW10.6 . the pe configuration is the same.

C:\Freescale\CW MCU v10.6\MCU\CodeWarrior_Examples\Processor_Expert\Kinetis\TWR-KL05Z48M\I2C

I attached it here for your convenience.

Best Regards,

Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
1,195件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

hello Grzegorz,

as i know Freescale doesn't have I2C pe demo code under KDS.

I suggest you refer according I2C processor expert sample code under CW10.6 . the pe configuration is the same.

C:\Freescale\CW MCU v10.6\MCU\CodeWarrior_Examples\Processor_Expert\Kinetis\TWR-KL05Z48M\I2C

I attached it here for your convenience.

Best Regards,

Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信