How to calculate the IIC baud rate for MKL02Z32CAF4R?My bus clock is 24MHZ. I want to set the baud rate as 100kbits/s.
How to set the IIC baud rate in the PE tool. I can only select the SCL clock frequency.What is the relation between the SCL clock frequency and IIC baud rate?
Hi Robin,
1) The I2C baud rate :
(refer to the RM about the I2C -> I2Cx_F (I2C Frequency Divider register) ) .
And the " I2C divider " can get from here "30.4.1.10 I2C divider and hold values " .
2) Refer to your need the baud rate 100kbit/s , you can configurale like this :
Best Regards,
Alice
------------------------------------------------------------------------------------------
If this post answers your question, please click the Correct Answer button.
-----------------------------------------------------------------------------------
If this post help your question, please click the helpful Answer button.
Thank you.
I still have some questions.
1.What is the difference between bus clock and bus speed? Are they the same?
My bus clock is 24MHZ.And I want to set the baud rate as 100kbits/s.Then ,
100kbits=24Mhz/(MUL*SCL divider). Is it right?
2.What is the difference between SCL clock frequency and IIC baud rate? Are they the same?
3.I set the SCL clock frequency of IIC0 and IIC as 100khz in the PE tool and generate the code.But the prescaler value is different for them.
For IIC0:
I2C0_F = (I2C_F_MULT(0x00) | I2C_F_ICR(0x1F));
For IIC1:
I2C1_F = (I2C_F_MULT(0x01) | I2C_F_ICR(0x1F));
Is it OK?
Hi Robin,
1) Yes, bus clock is bus speed ,they are the same. Right.
2)I2c buad rate = SCL clock frequency .
3) I2C0 module clock is bus clock , (in here 24M), I2C1 module clock is system clock, (in there is 48MHZ) ;
so when you configurate the two i2c SCL clock both 100k, in the I2C0 , I2C_F_MULT(0x00) , while in i2c1 I2C_F_MULT(0x01) . Its ok !
Best Regards
Alice