-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STM32WL I2C doesn't work with LPM #37414
Comments
As a workaround, you might want to set The correct solution for the STM32L4 is to prevent the SoC going to STOP2 mode where I2C can't function (well except I2C3) when waiting for the I2C interrupt. The I2C peripherals still need the HSI clock in STOP0 or STOP1 mode. |
@aurel32 You are right, I have removed the STOP2 mode from board dts, and then I2C works in LPM. What I want is to work back after wake up from STOP2 mode. So I have called the I2C driver init(
|
I am not sure it needs to be re-inited when exiting STOP2 mode. In my case (again STM32L4), the I2C module survives the STOP2 mode as long as there is no I2C transaction running when entering STOP2. That's why disabling Now I guess you indeed need to re-init the I2C module if the SoC entered STOP2 mode with a transaction running, which probably totally messes up its state. |
I haven't any issues with
I have no transaction when entering STOP2 mode. Now I have got running by configure the I2C2 again after wake up from STOP2 like this:
But it's the hard coded configuration for I2C, there is not easy way to convert the I2C clock-frequency of dts to I2C driver configuration like |
Do you mean you have a defined a custom power management policy? For me with the default PM residency policy, the SoC automatically enters the STOP2 mode during an I2C transaction.
Not sure I can't really help you here, on the STM32L4 there is no need to reconfigure the I2C device when leaving the STOP2 mode. Maybe have a look at the STM32WL datasheet to have a better idea about what has to be restarted? I am afraid that |
I have to disabled LPM because there are similar issues with other peripherals like ADC. So I have entered STOP mode using STM32 LL library, not using Zephyr PM :-(. After digging the driver, I knew, should call [UPDATE] |
It seems there is no Note that keeping I2C clock is still possible for checking : "All U(S)ARTs, LPUARTs and I 2 Cs have the capability to enable the HSI16 oscillator even when the MCU is in Stop mode (if HSI16 is selected as the clock source for that peripheral)." |
Moving from bug to enhancement as PM is not fully implemented yet. |
Reinitialize the following peripherals with recently added reinit logic upon exiting STOP2 power state: ADC, I2C, SPI, and USART. These peripherals lose clock context and register contents when the SoC enters STOP2 mode, and don't operate correctly when it reenters RUN mode without individual peripheral reinitialization. closes: zephyrproject-rtos#37352 zephyrproject-rtos#37414 zephyrproject-rtos#59194 Signed-off-by: Kenneth J. Miller <ken@miller.ec>
Reinitialize the following peripherals with recently added reinit logic upon exiting STOP2 power state: ADC, I2C, SPI, and USART. These peripherals lose clock context and register contents when the SoC enters STOP2 mode, and don't operate correctly when it reenters RUN mode without individual peripheral reinitialization. closes: zephyrproject-rtos#37352 zephyrproject-rtos#37414 zephyrproject-rtos#59194 Signed-off-by: Kenneth J. Miller <ken@miller.ec>
Reinitialize the following peripherals with recently added reinit logic upon exiting STOP2 power state: ADC, I2C, SPI, and USART. These peripherals lose clock context and register contents when the SoC enters STOP2 mode, and don't operate correctly when it reenters RUN mode without individual peripheral reinitialization. closes: zephyrproject-rtos#37352 zephyrproject-rtos#37414 zephyrproject-rtos#59194 Signed-off-by: Kenneth J. Miller <ken@miller.ec>
Reinitialize the following peripherals with recently added reinit logic upon exiting STOP2 power state: ADC, I2C, SPI, and USART. These peripherals lose clock context and register contents when the SoC enters STOP2 mode, and don't operate correctly when it reenters RUN mode without individual peripheral reinitialization. closes: zephyrproject-rtos#37352 zephyrproject-rtos#37414 zephyrproject-rtos#59194 Signed-off-by: Kenneth J. Miller <ken@miller.ec>
Hi @erwango, This issue, marked as an Enhancement, was opened a while ago and did not get any traction. Please confirm the issue is correctly assigned and re-assign it otherwise. Please take a moment to review if the issue is still relevant to the project. If it is, please provide feedback and direction on how to move forward. If it is not, has already been addressed, is a duplicate, or is no longer relevant, please close it with a short comment explaining the reason. @honestech74 you are also encouraged to help moving this issue forward by providing additional information and confirming this request/issue is still relevant to you. Thanks! |
As suggested @honestech74 re-configure the i2c timings on What i've done so far (don't know if it's good practice):
And call it in |
@Djammall Sounds like correct, don't hesitate to contribute it and we can discuss the details directly in the PR |
Fix suggested in zephyrproject-rtos#37414 (comment) Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Fix suggested in zephyrproject-rtos#37414 (comment) Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Fix suggested in zephyrproject-rtos#37414 (comment) Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Fix suggested in zephyrproject-rtos#37414 (comment) Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Describe the bug
When enabled the low power management using
CONFIG_PM
, STM32WL I2C doesn't work with J-Link but sometimes works with STM32CubeProgrammer usingopenocd
(notstm32cubeprogrammer
). There is the same issue #37352.Also It's not working when using low power STOP mode manually without
CONFIG_PM
.To Reproduce
Steps to reproduce the behavior:
boards/arm/nucleo_wl55jc/board.cmake
) fornucleo_wl55jc
board to useJ-Link
CONFIG_PM
tosamples/sensor/bme280
Expected behavior
When disabled
CONFIG_PM
, it works well.When enabled
CONFIG_PM
, it doesn't work at all. Even if the log shows the zero values, you can't see any I2C signals on I2C lines. I have checked the I2C line using the logic analyzer.Log
Environment (please complete the following information):
c4079e4be2
The text was updated successfully, but these errors were encountered: