AnsweredAssumed Answered

I2C example for InternalI2C component

Question asked by Grzegorz Kaczmarek on Nov 20, 2014
Latest reply on Nov 24, 2014 by ZhangJennie

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

Outcomes