cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to setup I2C2 master clock to 1MHz on STM32F7xx?

anonymous.8
Senior II

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Piranha
Chief II

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.

View solution in original post

6 REPLIES 6

> 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

Piranha
Chief II

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.

Setting PPREx to 0 makes "0xx: HCLK not divided", thus, making PCLK equal to HCLK. Not the 1MHz that my EEPROM requires.

anonymous.8
Senior II

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!

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

Sorry if it's wasn't clear. My first forum post ever. Thanks for helping.

Slava