i2c interface with K65

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

i2c interface with K65

跳至解决方案
926 次查看
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.

标签 (1)
1 解答
399 次查看
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

在原帖中查看解决方案

1 回复
400 次查看
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