Skip to content

Conversation

HoZHel
Copy link
Contributor

@HoZHel HoZHel commented Aug 12, 2025

Provide PM support, specifically suspend-to-ram.

Add PM support to the Bluetooth HCI driver.

Optimize power consumption for the Nucleo-WB09KE board.

Provide radio timer driver for STM32WB0x SoCs to be used as the system timer when Bluetooth and/or PM are enabled.

Set the appropriate value for SYS_CLOCK_HW_CYCLES_PER_SEC and
SYS_CLOCK_TICKS_PER_SEC when radio timer is used as the system timer.

Enable UART wake-up line in STM32 driver.

Fix the improper use of CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC for some
STM32WB0 drivers due to the misunderstanding of its definition.

Update west to point to the recent changes for hal_stm32.

Supplementary PR #303.

@mathieuchopstm, thank you for your support in PM.

@HoZHel HoZHel force-pushed the PM_with_radio_timer branch from 7e53340 to be88807 Compare August 13, 2025 08:05
Copy link

github-actions bot commented Aug 13, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
hal_stm32 zephyrproject-rtos/hal_stm32@dc7c254 zephyrproject-rtos/hal_stm32@d768bcb zephyrproject-rtos/[email protected]

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@github-actions github-actions bot added manifest manifest-hal_stm32 DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Aug 13, 2025
@mathieuchopstm mathieuchopstm self-requested a review August 19, 2025 11:23
@HoZHel HoZHel requested a review from erwango August 22, 2025 09:05
Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick skimming

@HoZHel HoZHel force-pushed the PM_with_radio_timer branch 3 times, most recently from 1836ad9 to 6e06ff5 Compare September 1, 2025 16:12
@HoZHel HoZHel force-pushed the PM_with_radio_timer branch from 6e06ff5 to 52716ce Compare September 3, 2025 10:35
@HoZHel HoZHel marked this pull request as ready for review September 3, 2025 13:01
@zephyrbot zephyrbot added area: UART Universal Asynchronous Receiver-Transmitter area: ADC Analog-to-Digital Converter (ADC) area: Crypto / RNG area: Timer Timer area: RTC Real Time Clock platform: STM32 ST Micro STM32 area: Bluetooth HCI Bluetooth HCI Driver area: Clock Control area: Bluetooth labels Sep 3, 2025
mathieuchopstm
mathieuchopstm previously approved these changes Oct 1, 2025
etienne-lms
etienne-lms previously approved these changes Oct 1, 2025
Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM AFAICT.

@erwango
Copy link
Member

erwango commented Oct 2, 2025

HAL counterpart PR has just been merged, you can update the west manifest.

asm5878
asm5878 previously approved these changes Oct 3, 2025
Copy link
Contributor

@asm5878 asm5878 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to hichlight recent changes on suspend to ram managment:

PM: Refactor S2RAM kconfigs to rely on devicetree and soc: #96292

@erwango
Copy link
Member

erwango commented Oct 3, 2025

PM: Refactor S2RAM kconfigs to rely on devicetree and soc: #96292

@asm5878 Did you notice some impact on this change ?

# to use SoC-specific hardware registers for resume detection.
select PM_DEVICE if PM
select PM_S2RAM if PM
select HAS_PM_S2RAM_CUSTOM_MARKING if PM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this option can be selected even when PM is not selected, like HAS_PM, not blocking

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

# need to be reinitialized after resuming. CUSTOM_MARKING is enabled
# to use SoC-specific hardware registers for resume detection.
select PM_DEVICE if PM
select PM_S2RAM if PM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This selection is redundant, PM_S2RAM is enabled automatically based on devicetree. With this line, it is now not possible to enable PM without enabling PM_S2RAM. This may be intentional, so not blocking, but the design allows for enabling PM but disabling the suspend-to-ram states in the devicetree like any other state.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a situation where it makes sense to enable PM without any low-power state?
On this SoC, the only low-power mode is suspend-to-ram.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only suspend-to-ram is supported on this SoC; however, I updated to remove redundancy and comply with the design concept.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a situation where it makes sense to enable PM without any low-power state? On this SoC, the only low-power mode is suspend-to-ram.

I don't think so, that's what "This may be intentional, so not blocking" was referring to, should have been more precise.

HoZHel added 5 commits October 3, 2025 11:18
Provide PM support, specifically suspend-to-ram, for STM32WB0x.

Enable STM32_RADIO_TIMER Kconfig parameter when PM is set.

Signed-off-by: Ali Hozhabri <[email protected]>
Enable UART wake-up line in STM32 driver.

Signed-off-by: Ali Hozhabri <[email protected]>
Add PM support to the STM32WB0x Bluetooth HCI driver.

Implement PM event register to wake up the device for its BLE events.

Signed-off-by: Ali Hozhabri <[email protected]>
Optimize power consumption for the Nucleo-WB09KE board by
implementing correct pull-up/pull-down configurations when the device
enters lower power states.

Disable the SMPS with floating output in suspend-to-ram (deepstop)
power state.

Signed-off-by: Ali Hozhabri <[email protected]>
Update west.yml to point to the recent changes for hal_stm32.

Signed-off-by: Ali Hozhabri <[email protected]>
@HoZHel HoZHel force-pushed the PM_with_radio_timer branch from 49b4402 to cb2ee70 Compare October 3, 2025 09:28
@github-actions github-actions bot removed the DNM (manifest) This PR should not be merged (controlled by action-manifest) label Oct 3, 2025
Copy link

sonarqubecloud bot commented Oct 3, 2025

Copy link
Contributor

@bjarki-andreasen bjarki-andreasen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool

Copy link
Member

@jhedberg jhedberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is @andyross really the right assignee for this?

@bjarki-andreasen
Copy link
Contributor

Is @andyross really the right assignee for this?

I would expect it to be STM or PM maintainers, so probably no? I see no issue in reassigning this one if neccesary

@erwango erwango assigned erwango and unassigned andyross Oct 3, 2025
@cfriedt cfriedt merged commit 4ba658d into zephyrproject-rtos:main Oct 4, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ADC Analog-to-Digital Converter (ADC) area: Bluetooth HCI Bluetooth HCI Driver area: Bluetooth area: Clock Control area: Crypto / RNG area: RTC Real Time Clock area: Timer Timer area: UART Universal Asynchronous Receiver-Transmitter manifest manifest-hal_stm32 platform: STM32 ST Micro STM32

Projects

None yet

Development

Successfully merging this pull request may close these issues.