cpu/stm32: add pm support in uart, spi and i2c (f4)#7787
cpu/stm32: add pm support in uart, spi and i2c (f4)#7787kaspar030 merged 4 commits intoRIOT-OS:masterfrom
Conversation
| * @name Power modes | ||
| * @{ | ||
| */ | ||
| #define PM_STOP (1U) |
There was a problem hiding this comment.
/cpu/stm32_common/periph/pm.c should use these defines in pm_set.
|
Changed uart pm so that stop mode is blocked only if rx is used |
|
I don't quite understand the concept. E.g. we have sys/shell enabled — so it will block all power management until we manually disable corresponding UART every time before we go to sleep and reenable it right after wakeup? Seems totally meaningless to me. Why anyone needs it? If you need shell access all the time, just disable PM at all. |
|
@olegart a program with shell will never sleep, that's correct. Except if you have a low-power UART. |
I think you do. The concept is just not fully implemented, thus you're right, on most (if not all) platforms, simple UART RX will block most low power modes. |
|
Yes, but why? If I need permanent shell access, I'd rather disable LPM at all, no difference with current RIOT logic. If I need sleepy device with occasional shell access (e.g. we have devices with 15 seconds of regular shell right after boot), I'll disable/enable LPM when I need that access. With proposed changes — nothing actually changes for us in the first case, and the second case just doesn't work anymore as I can't just disable UART peripheral currently in use by the shell. |
|
Long story short,
That's not an added functionality, that's reduced functionality. |
You can probably still do that. How's the timeout currently implemented? |
That is not correct. |
RTC timer setting pm_prevent_sleep global variable to 0 after 15 seconds. PM checks the variable before switching to STOP mode.
No. There's no option to disable shell, shell_run function is a one-way ticket. If I power down UART port used by it, shell will hang on the very next attempt to TX anything. |
Let's please not mix up concepts and implementation. Your use case could probably be implemented in uart_stdio (e.g., by adding You could also just unblock the corresponding powermode on your board once, after your timeout. Or add an option to shell to exit after a certain time. The implementation of pm_layered is currently incomplete, but the general concept seems to map to most use-cases, on most hardware, so far. |
|
See also: #7947 |
|
Please squash! |
a2dc72e to
857b44a
Compare
|
rebased and squashed |
|
Due to the default pm_blocker, problems won't show up for a while... ;) |
This add
pm_layered-based power management in uart, spi and i2c (f4 only so far though).