1
\$\begingroup\$

Currently, I am implementing I2C communication with Interrupt.

STM32 serves as the slave and Arduino serves the master.

MCU: STM32L152RDT6

For previous work, I2C communication in standard mode is appropriate.


In the page 110 of the MCU datasheet, it says that fpclk1 shall be a multiple of 10MHz to reach fast mode clock.

https://www.st.com/resource/en/datasheet/stm32l152rd.pdf


However, in this discussion thread,

https://community.st.com/s/question/0D50X00009XkaUGSAZ/i2c-fast-mode-400khz

Someone replied that setting of fpclk1 shall depend on the duty cycle of I2C.

In 2/1 duty cycle, fpclk shall be a multiple of 1.2MHz (400KHz*3).

Under this assumption, I re-configured my clock source from HSI to PLL and change to SCL speed of Arduino to 400KHz.

As shown in this image. STM32 Clock Configuration

New system clock and fpclk1 for 24MHz are configured.

However, callback function HAL_I2C_SlaveRxCpltCallback cannot be executed.

Does anyone know the right configuration of fpclk1?

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.