Brian Mohlman

I2C Basics

Discussion created by Brian Mohlman on Nov 19, 2015
Latest reply on Nov 26, 2015 by Butcher

Hello All,

 

Newbie to using I2C on a KE06 FRDM board. I set the PE component up per the help file on it in KDS. (I2C1 channel on PTE0 and PTE1) I have the interrupt setting the transmitted flag True and a timer loop that transmits the same message every 160mS.  I have the 4.7k pullups on the line. My question is if I don't have another I2C device connected to the bus should I be able to see the clock and data lines toggling with a scope? Or must a slave device be connected for I2C to operate properly? Currently the interrupt never fires and the program is stuck here: Highlighted in red.

 

 

 

  CI2C1_SelectSlaveDevice(I2C1_Ptr, LDD_I2C_ADDRTYPE_7BITS, SlaveID); /* Select Slave to write to */

  Error = CI2C1_MasterSendBlock(I2C1_Ptr, OutDataPtr, 4U, LDD_I2C_SEND_STOP); /* Send OutData (4 bytes) on the I2C bus and generates a stop condition to end transmission */

  while (!DataTransmittedFlg) {                                     /* Wait until OutData are transmitted */

   }

   DataTransmittedFlg = FALSE;

 

Regards,

 

Brian

Outcomes