AnsweredAssumed Answered

KL27 I2C Speed Problem

Question asked by PHIL HALE on May 8, 2018
Latest reply on May 9, 2018 by Jing Pan

I am not quite getting the initialization of the I2C baud rate. Normally, I use the same speed of I2C for all my projects so this is never an issue. Now, I am using an SDK from somebody and they want to set their own I2C speeds for their ICs.


See attached I2C.c file.


I have "acquired" this code from the KDS 2.0 SDK library - or at least it is close. Copyright preserved.


My MCU is a:  MKL27Z256VFM4

System Bus Speed: 48 MHz


I am not able to get the speeds I need when I put this on the scope. Not even close.


It seems pretty clunky to get the I2Cx_F settings this way but I'm sure there is a good reason.


I am also getting locking up when in I2C wait states when using the setting suggested for 20 kbps.


I have read the double-buffering causes lock ups at these slower speeds. But, the SDI I am using from this vendor is hardcoding a rate of 20 kbps. Even when I override the inbound 20 kbps to 50 kbps the problem still occurs.


Any suggestions?


Thanks in advance.