i2c interface with K65

cancel
Showing results for 
Search instead for 
Did you mean: 

i2c interface with K65

Jump to solution
620 Views
annamol
Contributor IV

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.

Labels (1)
1 Solution
93 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Annamol:

MQX support the I2C interface in both master and slave mode. If enabled in user configuration, the I2C driver is installed during the BSP startup code as the "i2cx" in polled mode and as the "ii2x" in interrupt mode where "x" stands for a specified I2C channel number. Example applications are provided in the MQX RTOS source tree for both master and slave mode.

C:\Freescale\Freescale_MQX_4_2\mqx\examples\i2c

C:\Freescale\Freescale_MQX_4_2\mqx\examples\i2c_slave

Regards

Daniel

View solution in original post

1 Reply
94 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Annamol:

MQX support the I2C interface in both master and slave mode. If enabled in user configuration, the I2C driver is installed during the BSP startup code as the "i2cx" in polled mode and as the "ii2x" in interrupt mode where "x" stands for a specified I2C channel number. Example applications are provided in the MQX RTOS source tree for both master and slave mode.

C:\Freescale\Freescale_MQX_4_2\mqx\examples\i2c

C:\Freescale\Freescale_MQX_4_2\mqx\examples\i2c_slave

Regards

Daniel

View solution in original post