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. This forum is NOT for support.
vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: Power Driver for stm32l1

Postby vrollei » Wed Jun 14, 2017 6:10 pm

Hi,

prototype of PWR driver is attached. It supports L1 and L4 on MSI/HSI.
Attachments
pwr.zip
(12.88 KiB) Downloaded 213 times
Vitaly

vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: Power Driver for stm32l1

Postby vrollei » Thu Jun 22, 2017 9:38 pm

Hi!

any feedback?
Vitaly

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Power Driver for stm32l1

Postby Giovanni » Thu Jun 22, 2017 9:51 pm

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

vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: Power Driver for stm32l1

Postby vrollei » Thu Jun 22, 2017 10:07 pm

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.
Vitaly

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Power Driver for stm32l1

Postby Giovanni » Fri Jun 23, 2017 8:19 am

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

vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: Power Driver for stm32l1

Postby vrollei » Mon Jul 03, 2017 2:39 pm

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.
Attachments
pwr.zip
(11.16 KiB) Downloaded 200 times
Vitaly

vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: Power Driver for stm32l1

Postby vrollei » Fri Sep 15, 2017 1:29 pm

Hi,

shall we continue?
Vitaly

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Power Driver for stm32l1

Postby Giovanni » Fri Sep 15, 2017 2:18 pm

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

vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: Power Driver for stm32l1

Postby vrollei » Fri Sep 15, 2017 2:37 pm

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.
Vitaly

vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: Power Driver for stm32l1

Postby vrollei » Mon Sep 18, 2017 9:21 am

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.
Vitaly


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 12 guests