I2C Basics

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

I2C Basics

1,888件の閲覧回数
bitjockey
Contributor II

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

ラベル(1)
0 件の賞賛
返信
3 返答(返信)

1,573件の閲覧回数
bitjockey
Contributor II

Read a little more on the I2C spec, I am supposing since there is no slave, i.e., no ack bit that this would cause my issue???

0 件の賞賛
返信

1,573件の閲覧回数
mjbcswitzerland
Specialist V

Brian

See http://www.utasker.com/kinetis/FRDM-KE06Z.html which includes KE06 I2C operation, including simuation of the KE06, I2C and the accelerometer.

If using PE you may find that nothing is in fact controlling the DatatransmittedFlg and you may need to add its control in the I2C interrupt.

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html

I2C: http://www.utasker.com/docs/uTasker/uTaskerIIC.PDF

KE: http://www.utasker.com/kinetis/FRDM-KE02Z.html / http://www.utasker.com/kinetis/FRDM-KE02Z40M.html / http://www.utasker.com/kinetis/FRDM-KE04Z.html / http://www.utasker.com/kinetis/FRDM-KE06Z.html

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 件の賞賛
返信

1,573件の閲覧回数
carlos_neri
NXP Employee
NXP Employee

You will see the clocks and slave address on the data line and a NACK as you mention. you might want to look for a function on the PE generated code that asks for the transaction status, which probably sets a "NACK Received" flag.

0 件の賞賛
返信