2024-02-05 1:23 AM - last edited on 2024-02-05 7:36 AM by mƎALLEm
Hello all,
I'm having problems with I2C1, i have a code that works perfectly while i configure the HCLK to 8MHz but it stops working when i set any higher frequency. Has anybody faced similar problem?
I am using STM32CubeIDE for setting the project, this microcontroller has a separate clock from HCLK, and i can't understand why I'm having this problem.
Thanks in advance.
2024-02-07 4:05 AM
Hello again,
i've been debugging and i found that when i increase the frequency and the comunication stops, in te Master i have the TXE and BUSY flags, but in the Slave i have set the TXE, BUSY and ADDR.
Master keeps looking for the TXIS but nothing happens.
Any recomendations about that?
Also i want to ask about the I2C clock diagram, because i see that the source clock for the I2C is not the same as for the registers, maybe i'm forgetting something needed to match between I2C and registers while modifying de frequency?
This block diagram is from de STM32F042F6P6 reference manual
thanks!
2025-10-19 7:31 PM
I also have the same issue with I2C communication. My project includes AHT20 as the temperature sensor to read the environment status.
In the beginning, I successfully implemented the AHT20 communication under HAL_I2C_Receive/Transmit, under 72MHz HCLK. As the project has heavy workload in data conversion, I tried to use the HAL_I2C_Receive_IT/Transmit_IT to reduce the time lag in peripherals' communication.
But the only way to let the AHT20 work is by locking the HCLK to 8MHz. Any frequencies of HLCK are higher than 8MHz, whether it is the crystal or the internal generator, the system can't generate the interruption to be captured by the callback function. No way to resolve this issue till now.
2025-10-19 7:32 PM
Do you find a way to resolve it? My MCU is C8T6, but I believe we have the same trouble at this point.