[riot-users] Cortex Kinetis KW2xD Low Power Modes

Olivier Fauchon ofauchon2204 at gmail.com
Sun Nov 18 20:15:42 CET 2018


Hi Joakim.

I 've been playing with your PR here:
https://github.com/gebart/RIOT/tree/pr/kinetis-pm.

To make it work with my custom board, I made some changes in my local board
definition:

   * include/periph_conf.h

#define LPTMR_NUMOF             (1U)
#define LPTMR_CONFIG { \
        { \
            .dev = LPTMR0, \
            .base_freq = 32768u, \
            .llwu = LLWU_WAKEUP_MODULE_LPTMR0, \
            .src = 2, \
            .irqn = LPTMR0_IRQn, \
        }, \
    }

  *  include/board.h

/* LPTMR xtimer configuration */
#define XTIMER_DEV                  (TIMER_LPTMR_DEV(0))
#define XTIMER_CHAN                 (0)
/* LPTMR is 16 bits wide and runs at 32768 Hz (clocked by the RTC) */
#define XTIMER_WIDTH                (16)
#define XTIMER_BACKOFF              (5)
#define XTIMER_ISR_BACKOFF          (5)
#define XTIMER_OVERHEAD             (4)
#define XTIMER_HZ                   (32768ul)

Is that right ?


After that,  I found out   low power modes were blocked because of some
PM_BLOCK() in UART.

As a workaround, I added uart_poweroff(UART_DEV(0)) before xtimer_sleep()
in my main thread loop.
(So the uart don't limit pm_set_lowest() )


Since I flashed this new binary, I cannot connect anymore my board through
openocd/jlink/swd.

I'm wondering if my board is bricked (maybe the low power mode shuts down
JTAG too fast after boot ? )

As soon as I have a new working board, I'll continue working on your code.

(Of course I'll add safeguard so low power mode cannot activate that fast
at poweron)

Any ideas/comment welcome

Thanks
Olivier.






Le ven. 16 nov. 2018 à 08:14, Joakim Nohlgård <joakim.nohlgard at eistec.se> a
écrit :

> Hi again,
>
> On Thu, Nov 15, 2018 at 10:36 PM Olivier Fauchon <ofauchon2204 at gmail.com>
> wrote:
> >
> > Hi.
> > It seems the board I use don't have LPTMR declared :
> >
> >
> https://github.com/RIOT-OS/RIOT/blob/master/boards/pba-d-01-kw2x/include/periph_conf.h
> >
> > #define PIT_NUMOF               (2U)
> > #define PIT_CONFIG {                 \
> >         {                            \
> >             .prescaler_ch = 0,       \
> >             .count_ch = 1,           \
> >         },                           \
> >         {                            \
> >             .prescaler_ch = 2,       \
> >             .count_ch = 3,           \
> >         },                           \
> >     }
> > #define LPTMR_NUMOF             (0U)
> > #define LPTMR_CONFIG {}
> > #define TIMER_NUMOF             ((PIT_NUMOF) + (LPTMR_NUMOF))
> >
> >
> > Can you confirm I need to declare LPTMR to get Low Power Mode working ?
>
> You will need LPTMR if you want to be able to use low power modes when
> you are using the xtimer module, which is usually required for things
> like network timeouts etc.
>
> > Do you have example of working LPTMR declarations ?
>
> Yes, look at the other Kinetis based boards in the tree. Here is one
> example from FRDM-K22F:
>
> https://github.com/RIOT-OS/RIOT/blob/836fe3dbbaba8b65bf23110c8b56cbaf1558c022/boards/frdm-k22f/include/periph_conf.h#L82-L90
>
> #define LPTMR_NUMOF             (1U)
> #define LPTMR_CONFIG {          \
>     {                           \
>         .dev = LPTMR0,          \
>         .irqn = LPTMR0_IRQn,    \
>         .src = 2,               \
>         .base_freq = 32768u,    \
>     },                          \
> }
>
>
> /Joakim
> _______________________________________________
> users mailing list
> users at riot-os.org
> https://lists.riot-os.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/users/attachments/20181118/58894e07/attachment.html>


More information about the users mailing list