Changing the poll time on a Thread Low Power End Device (KW41Z)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Changing the poll time on a Thread Low Power End Device (KW41Z)

Changing the poll time on a Thread Low Power End Device (KW41Z)

The Thread Low Power End Device is preconfigured to have both the MCU in low power state and the radio turned off most of the time to preserve battery life. The device wakes up periodically and polls its parent router for data addressed to it or optionally initiates sending data to the network by means of the parent router.

The low-power module (LPM) from the connectivity framework simplifies the process of putting a Kinetis-based wireless network node into the low-power or sleep modes. For the MKW41Z there are six low-power modes available.

By default, the Thread Low Power End Device uses Deep sleep mode 3, where:

  • MCU in LLS3 mode.
  • Link layers remain idle.
  • RAM is retained.

The wake-up sources are:

  • GPIO (push buttons).
  • DCDC power switch (In buck mode).
  • LPTMR with the 32kHz oscillator as clock source.

The LPTMR timer is also used to measure the time that the MCU spends in deep sleep to synchronize low-power timers at wake-up. See the Connectivity Framework Reference Manual and PWR_Configuration.h for more information about the sleep deep modes.

To change the polling time on deep sleep mode 3, we need to understand two macros:

   1. The cPWR_DeepSleepDurationMs macro in \framework\LowPower\Interface\MKW41Z\PWR_Configuration.h.

#ifndef cPWR_DeepSleepDurationMs
  #define cPWR_DeepSleepDurationMs                3000
#endif
‍‍‍‍‍‍‍‍‍‍‍

This macro determines how long the MCU will go to low power mode (deep sleep). The maximum value is 65535000 ms (18.2 h).

2. The THR_SED_POLLING_INTERVAL_MS macro in \source\config.h.

/*! The default value for sleepy end device (SED) polling interval */
#ifndef THR_SED_POLLING_INTERVAL_MS
    #define THR_SED_POLLING_INTERVAL_MS                     3000     /* Milliseconds */
#endif
‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This macro determines how often the Low Power End Device will send a poll message to its parent.

NOTE: This value does not determine how often the MCU wakes up.

The polling interval should be a multiple of the Deep sleep duration value, otherwise the poll will be sent at the next deep sleep time out.

As an example, let's say we configure the polling interval to 4000ms and the deep sleep duration to 3000ms. The MCU will wake up every 3000ms but the poll message will be sent every 2 deep sleep timeouts = 6000ms because the timers are synchronized when the MCU wakes up. The following figure shows the behavior of this example.

pastedImage_45.png

It is recommended that the polling interval is the same as the deep sleep duration, so the MCU doesn't wake up unnecessarily. The following figure shows this behavior.

pastedImage_49.png

Another macro to keep in mind is THR_SED_TIMEOUT_PERIOD_SEC in app_thread_config.h.

#ifndef THR_SED_TIMEOUT_PERIOD_SEC
    #define THR_SED_TIMEOUT_PERIOD_SEC                 ((4*THR_SED_POLLING_INTERVAL_MS)/1000 + 3)
#endif
‍‍‍‍‍‍‍‍‍‍‍

This value is the timeout period used by the parent to consider a sleepy end device (SED) disconnected. By default, this value is configured to be 4 times the polling interval + 3s. It is recommended to leave this macro as it is. This value is sent to the parent node during the commissioning.

Labels (2)
Comments

Using the example project frdmkw41z_wireless_examples_thread_low_power_end_device_freertos, I was able to successfully build run and connect the device to a hybrid ble thread router.  I then measured current draw to verify transmission frequency and as expected by default it is set to 3000ms.  I then modified the two defines as described and changed them to 5000 ms.  However when I retested the power draw I continued to see current spikes every 3000ms instead of the 5000ms I'd expect.  Is there anything additional I'm missing?

Hello Matthew,

Were those two macros the only changes you made to the project? I just tested your use case by changing both macros to 5000 ms and the poll is sent correctly every 5s.

On the latest MCUXpresso SDK the THR_SED_POLLING_INTERVAL_MS macro is located in \source\config.h.

Regards,

Gerardo

Thank you, the instructions are correct, it was my mistake.  I modified the define for THR_SED_POLLING_INTERVAL_MS is app_thread_config.h.

No ratings
Version history
Last update:
‎09-10-2020 02:45 AM
Updated by: