zephyr: STM32WL ADC doesn't work with power management
Describe the bug
If enabled CONFIG_ADC and CONFIG_PM, you can read just once using adc_read(), then Zephyr halts.
To Reproduce Steps to reproduce the behavior:
- add the
nucleo_wl55jc.overlaytosamples/drivers/adc/boards
/ {
zephyr,user {
io-channels = <&adc1 11>;
};
};
&adc1 {
pinctrl-0 = <&adc_in11_pa15>;
status = "okay";
};
- add configs to the sample project
CONFIG_PM=y
- build and flash with
nucleo_wl55jcboard - see the log
Expected behavior It should show the ADC reading every second.
Logs and console output Before enabled CONFIG_PM, could see the ADC value every second. After enabled CONFIG_PM, only could see the ADC value one time, then not running.
Environment (please complete the following information):
- Ubuntu 18.04
- Toolchain: 0.12.4
- Zephyr v2.6.99
[UPDATED]
- Zephyr commit SHA-1:
57690f5
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 21 (3 by maintainers)
Commits related to this issue
- Fix STM32 ADC blocking forever after STOP2 sleep Introduce Device Runtime Power Management for STM32 ADC, and call adc_stm32_init on resumptions. Could fix https://github.com/zephyrproject-rtos/zephy... — committed to sense-Jo/zephyr by sense-Jo 2 years ago
- soc: arm: stm32wl: Reinit select peripherals on STOP2 exit Reinitialize the following peripherals with recently added reinit logic upon exiting STOP2 power state: ADC, I2C, SPI, and USART. These per... — committed to knthm/zephyr by knthm a year ago
- soc: arm: stm32wl: Reinit select peripherals on STOP2 exit Reinitialize the following peripherals with recently added reinit logic upon exiting STOP2 power state: ADC, I2C, SPI, and USART. These per... — committed to knthm/zephyr by knthm a year ago
- soc: arm: stm32wl: Reinit select peripherals on STOP2 exit Reinitialize the following peripherals with recently added reinit logic upon exiting STOP2 power state: ADC, I2C, SPI, and USART. These per... — committed to knthm/zephyr by knthm a year ago
- soc: arm: stm32wl: Reinit select peripherals on STOP2 exit Reinitialize the following peripherals with recently added reinit logic upon exiting STOP2 power state: ADC, I2C, SPI, and USART. These per... — committed to knthm/zephyr by knthm a year ago
@Djammall Sure, go ahead, please make a PR. @gautierg-st will be able to provide guiding during the review
I occurred the same issue that the ADC on STM32WL does not work after STOP2 sleep. But I could solve it by re-initializing the ADC before it is used again, with the help of Device Runtime Power Management. However, I’m not sure whether this is the proper way to do it, and I didn’t test it intensively either. Nevertheless, one might want to have a look at this branch of my fork.
So likely it is another issue. Please raise a dedicated ticket giving any information that would help.
This seems specific to stm32wl55jc low power STOP2 mode, probably because “The content of all other peripherals is reset and must be reprogrammed.” Trying ./boards/arm/nucleo_wl55jc/nucleo_wl55jc.dts
the “ADC reading” continues after cold reboot