Hi
I have a MK82F design and I'm experimenting problems when trying to configure I2C baudrate at very high speed frequencies. I've no problem when configuring I2C frequency to until 400KHz. But when trying to configure the I2C frequency at for example 900KHz, the actual I2C frequency I get is 640KHz (measured by using an oscylloscope).
This difference is very big. I know that not all frequencies are possible to be implemented (check for example: I2C frequency - MKL33Z64VLH4 ), but this difference is really very big.
I've been debugging code execution and the function I2C_MasterSetBaudRate sets the following configurations:
Because my bus clock is 60M, the I2C frequency I should get is:
60M / 68 = 882352Hz = 882KHz
Which it sounds reasonably. The problem is the actual frequency I get is 640KHz.
I've checked this problem also at 700KHz. I've also verified clocks configuration and everythink looks correct: at higher I2C frequencies, bigger errors. Checking the Reference Manual I should be able to arrive to until 60M / 20 Hz, what should be around 3MHz. Capabilities in the line shouldn't affect to this frequency, just the waveform.
Could you confirm this problem?
Thanks in advance
Eduardo
Thanks for your help.
The problem is that I'm expecting to have 900KHz, so the actual range should be between 972KHz to 833KHz. But I'm getting 640HKz, which is outside the actual expected range.
When using an example application in the Freedom board, I get 780KHz (measured by using an oscylloscope) which is quite better than my own results, but again is outside the acual expected range (972KHz - 833KHz).
This is the code to run into the Freedom board (FRDM-K82F): Download
Any help would be welcome
Regards,
Eduardo
Hi
I will try to prepare you a code able to work on FRDM-K82, but it will take me a few days in order to find a bit of time. I guess that innacurate is differences of about 10%, but not around to 50%. If I'm expecting to get 900KHz and I get 882KHz, that is innacurate, but OK. But if I expect to have 900KHz and I get 640KHz, that is not innacurate: that is an error or a fraud.
Thanks for your help.
Regards,
Eduardo
Hi, Eduardo,
The baudrate is inaccurate when the ICR is from 0 to 0x0F, we have a notes which describes the drawback, i copy it here. When the ICR is 0x0F, the divider is 68, but the tolerance is +/-4, so the divider may be from 64 to 72. Assumer it is 72, the baudrate is 60MHz/72=833KHz, it match with your observation.
Hope it can help you
BR
Xiangjun rong
56.5.1.10 I2C divider and hold values
NOTE
For some cases on some devices, the SCL divider value may
vary by ±2 or ±4 when ICR's value ranges from 00h to 0Fh.
These potentially varying SCL divider values are highlighted in
the following table. For the actual SCL divider values for your
device, see the chip-specific details about the I2C module.
Hi, Eduardo,
I see that there is a table in reference manual of K82 which lists the map between ICR value and frequency divider for IIC module, and there is a highlighted conlumn that says that the divider is inaccurate when the ICR is from 0x00 to 0x0F.
Could you posted you code so that I can have a test on my FRDM-K82 board and confirm it is what as you said?
BR
XiangJun rong