cancel
Showing results for 
Search instead for 
Did you mean: 

I2C clock incorrect

NoNamed
Associate II

Screenshot (91).png

Im using the stm32f407 discovery to run I2C in fastmode (400kHz), using the equation given in the datasheet, I choose the system clock to be 120Mhz, so I have 30Mhz pclk for I2C. duty cycle T_low/T_high = 2, so CCR is 25d, T_rise is 300ns so that would result in 10d. But the clock doesn't be 400kHz, it keep changing at 333kHz or 500kHz. sorry for my bad english, appreciate for any help.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Increase your logic analyzer sampling rate. It appears to be 1 Msps which is not enough to get the resolution you want. This is an artifact of the logic analyzer, not an STM32 problem.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

3 REPLIES 3
Karl Yamashita
Lead III

If you are using CubeMX or STM32CubeIDE, attach your IOC file

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.
TDK
Guru

Increase your logic analyzer sampling rate. It appears to be 1 Msps which is not enough to get the resolution you want. This is an artifact of the logic analyzer, not an STM32 problem.

If you feel a post has answered your question, please click "Accept as Solution".

Thanks so much, after changing the sampling rate, the SCL show perfect 400kHz. Hope you all have a great day

Screenshot (92).png