Page 2 of 3
Re: Power Driver for stm32l1
Posted: Wed Jun 14, 2017 6:10 pm
by vrollei
Hi,
prototype of PWR driver is attached. It supports L1 and L4 on MSI/HSI.
Re: Power Driver for stm32l1
Posted: Thu Jun 22, 2017 9:38 pm
by vrollei
Hi!
any feedback?
Re: Power Driver for stm32l1
Posted: Thu Jun 22, 2017 9:51 pm
by Giovanni
Hi,
Having checks on STM32-specific macros into the high level part is a problem. Another problem is that some drivers could be active and be compatible with stop/halt modes.
It is not a general solution.
Giovanni
Re: Power Driver for stm32l1
Posted: Thu Jun 22, 2017 10:07 pm
by vrollei
Hi,
I will move STM32-specific checks to lld, not a problem.
Second issue hardly may be resolved without changes in drivers as we discussed earlier: counter or bit mask field.
Re: Power Driver for stm32l1
Posted: Fri Jun 23, 2017 8:19 am
by Giovanni
Yes, it requires an architectural change in HAL, I am not sure yet about the best way to proceed.
For 4 weeks I will be busy with work or travelling so don't worry if I am not very reactive. In August I will be off for vacations

Giovanni
Re: Power Driver for stm32l1
Posted: Mon Jul 03, 2017 2:39 pm
by vrollei
Hi,
All STM32 specific checks moved to pwr_lld_common.h,
fixed min sleep/stop period bug,
added support ST based on RTC (will create new post for ST on RTC topic).
Sources are attached.
Re: Power Driver for stm32l1
Posted: Fri Sep 15, 2017 1:29 pm
by vrollei
Hi,
shall we continue?
Re: Power Driver for stm32l1
Posted: Fri Sep 15, 2017 2:18 pm
by Giovanni
Hi,
I think the concept is not right yet, the driver is mutually exclusive with DAC, MAC, I2S, look at checks in pal_pwr.h.
Such a driver needs to know the state of other drivers, it requires some kind of system-wide registration system. It is not that simple.
Giovanni
Re: Power Driver for stm32l1
Posted: Fri Sep 15, 2017 2:37 pm
by vrollei
Do you mean this:
#if HAL_USE_I2S == TRUE
#error "PWR driver does not support I2S."
#endif
?
It is just a stub. I do not use these drivers, so not check these drivers state. There is no problem to add support of DAC, MAC and etc.
Re: Power Driver for stm32l1
Posted: Mon Sep 18, 2017 9:21 am
by vrollei
Hi,
I would like to suggest to discuss concept once more:
1. Power module can activate low power sleep/stop mode when all drivers are not active.
2. Drivers have to notify Power module on beginning and ending activities using Power module interface:
void pwrOnStartActivityNotification(void);
void pwrOnStopActivityNotification(void);
3. Notifications can be implemented using Driver State Machine transition:
- xxxStart() calls pwrOnStartActivityNotification()
- xxxStop() calls pwrOnStopActivityNotification()
4. Drivers with low power support should use different transition to notify Power module about activities (it is MCU and peripheral specific)
Additional note:
In OSAL_IRQ_HANDLER(ST_HANDLER) should be added call:
#if HAL_USE_PWR == TRUE
pwrOnExitIdleThread();
#endif
to prevent execution of chvt code on low mcu frequency.