I am working on a low power project using the STM32 "Bluepill" and I would like to use an LCD without the need to set the frequency for the HCLK (Core Clock) to anything beyond 500 kHz. Unfortunately however, the LCD stops working whenever I lower the frequency below 2 MHz (2 MHz seems to be a key value, since at that exact frequency the LCD starts displaying random letters).

Is there a way to use an I2C driver to display data on the LCD at low frequencies?

LCD: 16x2
Clock used: HSI
Prescaler: /16
I2C Clock speed: 100 kHz (normal mode)

The low frequency is necessary in order to minimize current draw.

  • 2
    \$\begingroup\$ STM32 datasheet, page 69: 2. f PCLK1 must be at least 2 MHz to achieve standard mode I2C frequencies. That is to achieve 100K bps data speed. Meantime, I2C spec does not limit low speed operations. So, I2C itself may not be the problem, but some other factors in the I2C peripheral of the STM32 or the LCD driver chip are responsible. \$\endgroup\$
    – jay
    Aug 24, 2021 at 2:53
  • \$\begingroup\$ isn't there any way to bypass this? \$\endgroup\$
    – A.H.Z
    Aug 24, 2021 at 10:48
  • 1
    \$\begingroup\$ I guess you first need to figure out what component limits your design. Does the LCD no longer work if I2C is lowered below 100kHz? Or does the STM32 I2C peripheral cause problems if the clock is lowered below 2 MHz? Once this is known, solutions can be discussed. \$\endgroup\$
    – Codo
    Aug 24, 2021 at 11:49
  • \$\begingroup\$ I believe the I2C peripheral is the problem here as @jay said above, however, it was interesting to know that even if the HCLK frequency is above the required 2 MHZ the LCD does not work at all if i lowered the I2C clock speed below 100 kHZ. \$\endgroup\$
    – A.H.Z
    Aug 24, 2021 at 14:42

1 Answer 1


Of course it is possible.

Most likely the problem is just trying to use too high I2C clock while core clock is low and the peripheral cannot initialize to your requested I2C speed with your HCLK.

Lower down I2C bus frequency accordingly.

Or don't use hardware I2C peripheral, use software bit-banging for the I2C bus.

  • \$\begingroup\$ the thing is I've already tried lowering the I2C clock speed but that doesn't work at all, even so it shouldn't have been a problem in the first place since normal mode I2C clock speed is about 100 KHZ which is 1/5th of my current frequency. \$\endgroup\$
    – A.H.Z
    Aug 24, 2021 at 10:43
  • 1
    \$\begingroup\$ The thing is the I2C hardware needs to know the peripheral clock frequency in MHz and minimum allowed value for that register is 2, so it is possible the I2C initialization code either writes an invalid value to this register, or the code knows this is an invalid situation and does not even try to initialize it. Do you know what the I2C init code does, does it return an error code? That's why I said you can just software bitbang it, or you can edit the I2C init code to fake the frequency is 2 MHz as it should still work. You also need to edit the clock control register for timing selection. \$\endgroup\$
    – Justme
    Aug 24, 2021 at 11:14
  • \$\begingroup\$ I am unfortunately not very familiar with I2C communication protocols and such(nor am I familiar with what the I2C init code does ) but I do know that it does not return an error. I mainly want to use I2C for convenience's sake, however, it is imperative for me to use a frequency of no more than 500 KHZ. I will take your advice and try the "faking" method you mentioned above. \$\endgroup\$
    – A.H.Z
    Aug 24, 2021 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.