Skip to main content
anonymous.8
Senior II
September 4, 2019
Solved

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

  • September 4, 2019
  • 3 replies
  • 1437 views

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!

This topic has been closed for replies.
Best answer by Piranha

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.

3 replies

waclawek.jan
Super User
September 4, 2019

> 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

anonymous.8
Senior II
September 5, 2019

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

waclawek.jan
Super User
September 5, 2019

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

Piranha
PiranhaBest answer
Principal III
September 4, 2019

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.

anonymous.8
Senior II
September 5, 2019

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!