STM32L1 I2C in Fast Mode
I am using the stm32l1xx_i2c.c code and I am successfully using I2C to interface with a BNO055 IMU. Everything is working perfectly at 100 kHz and now I want to speed that up as much as I can. My PCLK1 frequency is 32 MHz (which I realize is not a multiple of 10 MHz) so I can't reach 400 kHz but I want to get as close to that as possible.
Now, in my I2C_InitStructure, I have set the clock speed to 400000 (400 kHz). I have enabled clock stretching and set the fast mode duty cycle after enabling I2C using:
I2C_StretchClockCmd(I2C2, ENABLE);
I2C_FastModeDutyCycleConfig(I2C2, I2C_DutyCycle_2);I must clearly be missing something because I am still only measuring 100 kHz on my SCL line.
I apologize if the answer to this question is obvious. I am very new at working with STM32 microcontrollers and I2C.
Thanks!
#stm32l1-i2c