cancel
Showing results for 
Search instead for 
Did you mean: 

Configure I2c freq register while keeping in mind freq varaition

aamirali641989
Associate II
Posted on June 25, 2013 at 07:50

I am using STM32F205RTB6 with internal oscillator (+- 4%), & APB1 peripheral is clocked at 30Mhz.

So max variation in it is 28.8Mhz to 31.2Mhz

I have to operate I2c in fast mode.

Now while configuring CCR register , I had kept in mind this variation so come up the value of CCR = 21 , to keep within fast mode specs even if freq varies.

1.Now on configuring TRISE register, how to keep this variation in mind. tr = .3us

For 28.8 mhz i come up with = (28.8Mhz * 0.3us)+1 = (8.64 + 1) = 9.64

For 30.0 mhz i come up with = (30.0Mhz * 0.3us) +1= (9.00 + 1) = 10 

For 31.2 mhz i come up with = (31.2Mhz * 0.3us) +1= (9.36 + 1) = 10.36 

What value should be programmed exactly. 

Edit: Where I can freq. I want to operate at 390Khz for safe region. Where to set it, is it by setting tlow or thigh only

1 REPLY 1
zzdz2
Associate II
Posted on June 25, 2013 at 19:33

I think RCC should be 27 not 21 so in fast mode with DUTY=0 max i2c speed is 31.2MHz/(3*21)=385kHz, or you can use RCC=26  i2c=400kHz.

1.Now on configuring TRISE register, how to keep this variation in mind. tr = .3us

 

 

For 28.8 mhz i come up with = (28.8Mhz * 0.3us)+1 = (8.64 + 1) = 9.64

 

For 30.0 mhz i come up with = (30.0Mhz * 0.3us) +1= (9.00 + 1) = 10 

 

For 31.2 mhz i come up with = (31.2Mhz * 0.3us) +1= (9.36 + 1) = 10.36 

I'm not quite sure but I would use nearest integer here i.e. 10