zephyr: drivers: spi: stm32: Broken device power management on SPI bus

With PR #72991, the SPI driver does not work with PM device + runtime features enabled.

The bug was reproduced on the STM32WL device.

Steps to reproduce:

  1. In samples/subsys/lorawan/class_a add CONFIG_PM_DEVICE=y and CONFIG_PM_DEVICE_RUNTIME=y to prj.conf.

  2. Build the sample: west build -b lora_e5_mini

  3. Debug the sample (west debug), set the breakpoint to the main function b main, and run the code.

  4. The main function is never hit as it is stuck in the SPI driver (spi_ll_stm32.c:878 - in transceive function).

When I reverted the commit 858e8c51f1f42abb0afe62a4d701e69b7a6bd2b1 from PR #72991, the sample works as expected even with the above PM device options enabled.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 19 (14 by maintainers)

Most upvoted comments

Should I have enabled both?

No that’s fine. You did it correctly. We’ll need to investigate

We were able to fix the problem by setting the clock in the dts stm32_lp_tick_source, but maybe it was a different problem.

@erwango The PR https://github.com/zephyrproject-rtos/zephyr/pull/72703 was merged on May 24, 2024. My report was on Aug 17, 2024; I tested it on top of the main branch at that time. But I can try again with my above-provided test instructions.