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:

  1. add the nucleo_wl55jc.overlay to samples/drivers/adc/boards
/ {
	zephyr,user {
		io-channels = <&adc1 11>;
	};
};

&adc1 {
	pinctrl-0 = <&adc_in11_pa15>;
	status = "okay";
};
  1. add configs to the sample project
CONFIG_PM=y
  1. build and flash with nucleo_wl55jc board
  2. 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]

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 1
  • Comments: 21 (3 by maintainers)

Commits related to this issue

Most upvoted comments

@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.

@erwango PM is not enabled, no

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

&cpu0 {
	cpu-power-states = <&stop0 &stop1>;
};

the “ADC reading” continues after cold reboot