I2C example for InternalI2C component

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

I2C example for InternalI2C component

Jump to solution
3,645 Views
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

Labels (1)
Tags (2)
0 Kudos
Reply
1 Solution
1,197 Views
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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
1 Reply
1,198 Views
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 Kudos
Reply