AnsweredAssumed Answered

i2c interface with K65

Question asked by annamol alex on Apr 15, 2016
Latest reply on Apr 20, 2016 by Daniel Chen

Hi,

 

I am trying to interface AFE4404 with K65 and K53. The slave is getting powered and the clock is also there. AFE4404 registers are 24 bit. So I did the following change to write the data onto registers. I can see the content getting updated in I2C1_D register. I am working with MQX and bare metal code to get the interface up and running.But no luck

 

void MMA7660WriteRegister(unsigned char u8RegisterAddress, uint32_t u8Data1)

{

  uint32_t u8Data =0x000200;

  /* send data to slave */

  IIC_StartTransmission(0x58,MWSR);

  i2c_Wait();

 

  I2C1_D = u8RegisterAddress;

  i2c_Wait();

 

  I2C1_D = (u8Data & 0xFF0000)>>16;

  i2c_Wait();

//  i2c_Stop();

 

  I2C1_D = (u8Data&0x00FF00)>>8;

  i2c_Wait();

//  i2c_Stop();

  

  I2C1_D = (u8Data & 0x0000ff);

  i2c_Wait();

 

  i2c_Stop();

 

  Pause();

}

 

But when probing with a logic analyzer I can see only S and P pulses and nothing more.

Any idea on why this happens?

Is there any stable working code in MQX to interface I2C peripheral? The example projects gets locked up.

Outcomes