Power Driver for stm32l1

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome.
User avatar
Giovanni
Site Admin
Posts: 10134
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 205 times
Been thanked: 183 times
Contact:

Re: Power Driver for stm32l1

Postby Giovanni » Mon Sep 18, 2017 2:18 pm

This is clear, devil is in the details: Not all power states are the same, some peripheral can work in some power states but not others depending on the system state and various settings.

For example RCC settings have an impact, peripherals can be clocked or not clocked during low power states, this has to be configured somewhere. The various STM32s also have settings about power regulators and clock settings are impacted by those too (max clock frequency, flash wait states, etc).

About OSAL, putting calls to HAL in OSAL is not possible, OSAL depends on the RTOS and is used by HAL but it does cannot call HAL.

My general idea is to remove clock settings from hal_lld and create a specific "clock driver" allowing to change clock configurations at runtime for power management, probably power settings would be part of this but I don't have yet a detailed plan just an idea.

Giovanni

vrollei
Posts: 62
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 2 times

Re: Power Driver for stm32l1

Postby vrollei » Mon Sep 18, 2017 6:00 pm

Let's try to dive in details )

* hal_pwr:
- responsible for enter/exit low power modes (low power sleep, stop and standby, stm32 view) using idle_thread hooks
- makes decision to enter target power mode based on current hal drivers activities and/or application activities using incoming notifications (start/stop activity) and chVTGetTimersState
- uses PWR_ON_ENTER_X_MODE/PWR_ON_EXIT_X_MODE hooks to do some application specifics task on enter/exit low power mode, e.g. to change port/pin mode
- hal_pwr_lld(1): controls all PWR_xx registers directly, e.g voltage regulator mode according configuration
- hal_pwr_lld(2): controls clock using hal_rcc (now directly) and ST(changes prescaler in low power sleep modes to keep ST timer active, ST based on RTC can run in all modes without ST reconfiguration)
- hal_pwr_lld(3): has configuration: clock source in low power sleep mode, voltage regulator mode in low power sleep etc
- rcc notes: low power sleep mode - cpu clock off, no effect on other clocks or analog clock sources, stop - all clock off except LSI and LSE
- peripherals notes: some peripherals (UART, i2c) can wakeup MCU from STOP mode, so hal drivers have to support it somehow (stop_with_wakeup state e.g.?)
- wake up from STOP without ST based on RTC: should be implemented using RTC or other things, it is not part of hal_pwr

* hal_rcc: should implement hal_pwr_lld(2), should support configuration of peripherals clock in low power sleep modes (?)

* st_lld: is it part of hal and can it use hal_rcc or hal_pwr to restore clock on exit from low power modes?
Vitaly


Return to “Development and Feedback”

Who is online

Users browsing this forum: Baidu [Spider] and 3 guests