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. :smileywink:
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.
Phil
Can you suggest a good I2C0_F setting for 20, 40, 100, and 400 kbps?
Hi,
It is obviously that your SDK is not the most update one. I use SDK 2.3 and the code is different with yours. Please try the example frdmkl27z_driver_example_i2c_i2c_example. You can modify masterConfig.baudRate_Bps as you wish.
Regards,
Jing