2019-09-04 04:21 AM
Hello,
I'd like to connect EEPROM slave to I2C2 of STM32F767 MCU. EEPROM's supported clock is 1MHz. With 25 MHz HSE, I only managed to setup PCLK to 1.5625 MHz. Am I correct that it is imposible to setup I2C2 to 1 MHz with this setup?
Thanks!
Solved! Go to Solution.
2019-09-04 12:35 PM
You have to understand that peripheral bus clock is not I2C line clock. I2C has it's own prescaler and counters configurable in I2C_TIMINGR register. You can run PCLK1 at 54 MHz and I2C at 100 kHz, 400 kHz, 1 MHz or plenty of other frequencies and combinations in a wide range.
2019-09-04 11:13 AM
> With 25 MHz HSE, I only managed to setup PCLK to 1.5625 MHz.
So, the 25MHz HSE is your AHB clock?
And you can't set the APB divider to less than 16? Is there any problem with writing 0 into the respective RCC_CFGR.PPREx?
JW
2019-09-04 12:35 PM
You have to understand that peripheral bus clock is not I2C line clock. I2C has it's own prescaler and counters configurable in I2C_TIMINGR register. You can run PCLK1 at 54 MHz and I2C at 100 kHz, 400 kHz, 1 MHz or plenty of other frequencies and combinations in a wide range.
2019-09-04 10:33 PM
Setting PPREx to 0 makes "0xx: HCLK not divided", thus, making PCLK equal to HCLK. Not the 1MHz that my EEPROM requires.
2019-09-04 11:07 PM
I saw that tSCL = tSYNC1 + tSYNC2 + {[(SCLH+1) + (SCLL+1)] x (PRESC+1) x tI2CCLK}
so the requirement tPCLK < 4/3 tSCL
can be met.
Thanks again!
2019-09-05 01:22 AM
Ah... I thought you are complaining that you can't set PCLK *fast* enough to achieve 1MHz on I2C (after using its prescalers)...
@Piranha has a much clearer crystal cube than me.
Glad you got it going.
JW
2019-09-05 02:11 AM
Sorry if it's wasn't clear. My first forum post ever. Thanks for helping.
Slava