Skip to content
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

soc: stm32wb: fix ble low-power #82087

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gellhaar
Copy link

@gellhaar gellhaar commented Nov 26, 2024

Release HSI CLK48 semaphore when going to sleep to allow C2 (M0) core to start and stop clock as needed while C1 core is not running.

CLK48 is shared between RNG and USB. RNG is needed by M0 during BLE advertisement. A hardware semaphore can be locked by C1 to prevent C2 from stopping CLK48 in case C1 needs to use these peripherals.

If C1 is sleeping and C2 does BLE advertising CLK48 is started since C2 needs RNG to generate some BLE crypto stuff. If semaphore is locked, C2 core can start CLK48 when it needs to but not stop it. When C2 goes back to sleep, CLK48 is therefore left running with increased system power consumption as a result. Order is not restored until C1 later wakes up (because periodical low-power timer expires) and then goes back to sleep, but power consumption is broken as BLE advertisement cycle is repeated.

Fixes #69955.

Release HSI CLK48 semaphore when going to sleep to allow C2 (M0)
core to start and stop clock as needed while C1 core is not running.

CLK48 is shared between RNG and USB. RNG is needed by M0 during BLE
advertisement. If semaphore is locked, C2 core can start it when it
needs to but not stop it.

Fixes zephyrproject-rtos#69955.

Signed-off-by: Jonny Gellhaar <[email protected]>
Copy link

Hello @gellhaar, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

@gellhaar gellhaar force-pushed the fix/9955_stm32wb_low_power_with_ble branch from 03d43d9 to 4ee6704 Compare November 26, 2024 20:50
@erwango
Copy link
Member

erwango commented Nov 27, 2024

^^@benothmn-st, @asm5878

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stm32-WB55RG high power consumption between adv peaks
3 participants