Hi all,
I am using KL15, and I am trying to use I2C with very low data rate (2kHz, I am using EE893 sensor), but when I send data in output, the data is wrong (I must send 0x71 as address, and i see on the oscilloscope 0x7F) and after a numbers of retrasmission, nothing go out! When I set the speed at 100kHz, the data in output is correct and it doesn't stop after a number of retrasmission!
Can you help me?
Thanks
Marco
Hi Marco,
Would love to try to help. I have to admit that I have never heard of this problem before though.
Are you using a Freescale software package for your application? If so, what software offering are you using?
If not, it would be good to know your bus clock and core clock frequencies as well as the I2C settings and snippets of your code if possible. My initial impression is that there is some timing issue between what your code is doing and the status of the I2C module (i.e., maybe the core is writing registers before the I2C module is really ready to be changed).
Thanks,
Chris
Hi Christopher,
I am using KDS 1.1.1, the core clock is 40MHz and bus clock is 20MHz.
I am using this code (libohiboard library): https://github.com/ohilab/libohiboard/blob/develop/source/i2c_KL15Z4.c
and in the code I write:
/*************************** CODE ******************************/
uint8_t EE893_rxMessage[2];
Iic_Config co2IicConfig = {
.sclPin = CO2_SCL_PIN,
.sdaPin = CO2_SDA_PIN,
.baudRate = 2000,
.devType = IIC_MASTER_MODE,
.addressMode = IIC_SEVEN_BIT,
};
Iic_init(IIC1,&co2IicConfig);
Iic_readBytes (IIC0,0x71,EE893_rxMessage,2,IIC_STOP);
/*************************** CODE ******************************/
Thanks
Marco
Hi Marco,
Did you get a chance to try my suggestion?
Thanks,
Chris
Hi Christopher,
whit 20MHz and the SCL divider setted to 3840 (without MUL), we can use a 5kHz as baudrate. I can't use 500kHz of bus clock... I need more speeds!!! (like 20MHz)
Can you help me?
Thanks
Marco
Marco,
You say that you are seeing incorrect data sent at 2 kHz. Are you sure your baud rate is 2 kHz? By my calculations, with a 20 MHz bus clock speed, the minimum baud rate you could assign is ~79 kHz. Could you try setting your bus clock speed to 500 kHz? (That would be a core clock frequency of 2 MHz with a divide of 4 to make 500 kHz). Please let me know if that doesn't work.
Thanks,
Chris