I'm trying to figure out a weird little issue I've discovered while debugging another element of my code.
I've got a STM32F303K8 reading and writing to an I2C peripheral.
The I2C clock speed is configured to be 400 kHz in CubeMX, but that's not the actual clock speed when I look at it via a logic analyzer.
To make things more interesting/confusing, there seems to be an inverse relationship between the system clock speed and the actual I2C speed.
When I'm running at 8 MHz system clock (CubeMX config below):
My I2C clock looks like this on a logic analyzer:
Showing 333.33 kHz.
When I change the system clock up to 72 MHz (CubeMX below):
Logic analyzer trace of the I2C clock looks like this:
Giving me only 46.79 kHz. No other settings were changed.
My I2C settings are below (configured in 72 MHz mode - the 8 MHz mode is the same, except for the timing register).
I've been trying to root out the source of this all day, with not much luck. Does anybody know what's going on here, and what I can do to prevent this causing problems?
Thank you all so much for your help!