Hi all,
i ma trying to run I2C on kea 128 development board. the module which i am testing is I2C0 and the slave device being addressed is MPU IMU 9DOF.
I have done the mandatory setting required for configuring the i2c bus ,like the pin selection, clock rate and all,but i am not able to see anything on DSO of SDA or SCL pin. No clock generation is being done when i am doing some transaction on i2c bus.
I am using the I2C driver for KEA which have the necessary function for starting the I2C and configuring it for talking to a slave device.
I2C_ConfigType i2c_test; //object to I2C config struct in i2c.h
main()
{
/***I2C (100Khz) Configuration for Current sensor****/
SIM_PINSEL0 &= ~SIM_PINSEL_I2C0PS_MASK; //map i2c0 pins on PTA3,SCL and PTA2,SDA
i2c_test.u16F = 0x1E; //I2C baud rate = I2C module clock speed (Hz)/(mul × SCL divider) = 20Mhz/(1x192)
i2c_test.u16OwnA1 = 0x68; //slave address
i2c_test.sSetting.bI2CEn = 0x01;
I2C_Init(I2C0,&i2c_test);
while(1)
{
I2C_Start(I2C0);
I2C_WriteOneByte(I2C0,0x75); //read WHO_AM_I reg of IMU slave
I2C_ReadOneByte(I2C0,&i2c_rd,1);
Uart_SendChar(i2c_rd);
Uart_SendChar(0x0D);
I2C_Stop(I2C0);
LED0_ON;
delay_ms(500);
LED0_OFF;
delay_ms(500);
}
}
I have also attached the I2C drivers for ready reference>>>>>
when i run this code, nothing comes in uart port and led also doesn't blink. But if I disable all the I2C related functions, code runs perfect.Where am I going wrong.?????
HELP!!!!!!!!!!!
Thanks
Original Attachment has been moved to: iic.7z.zip