TWR-K21D50M MQX v4.0.2 VLPS Example.zip

File uploaded by Derek Snell Employee on Aug 28, 2013
Version 1Show Document
  • View in full screen mode

Rev0.1 - 8/28/2012

 

Adding to the patch at TWR-K21D50M lowpower MQX Patch for v4.0.2, this updates the MQX BSP and lowpower example to add VLPS mode.

 

The example works the same as the default lowpower example, except after waking from LLS, the application immediately enters VLPS.  It uses the LPTMR to wake after 10 seconds, and returns to RUN mode and restarts the example.  Because the transition is immediate from the user perspective, the user will press the switch to enter LLS mode, after 10s the MCU will wake, turn on the blue LED, enter VLPS, wait another 10s, wake, turn off the blue LED, return to RUN mode and resume printing to the terminal.  There is no text printed to the terminal between LLS and VLPS to show a quick transition.

 

This patch covers several files to enable VLPS mode in the twrk21d50m BSP, and modifies the lowpower example. The lowpower example is provided to demonstrate the MQX Low-Power Manager (LPM) driver, and change low-power modes on the K21 board.  The BSP in the release provided does not include support for VLPS.

To use this patch, copy the patch directory into the MQX v4.0.2 root directory.  The patch will over-write some existing files in the MQX installation.  The changes addressed by this patch include the following:

  1. User_config.h
    • MQX_ENABLE_LOW_POWER macro enabled.  Required for LPM driver and lowpower example.
  2. LowPower Example main.c
    • Modified as described above to add transition into VLPS mode
  3. bsp_cm.c
    • Added case for VLPS mode for clock mode transition
  4. init_lpm.c
    • Added mode to LPM_CPU_OPERATION_MODES[] for LPM_OPERATION_MODE_VLPS
  5. init_lpm.h
    • Added mode LPM_OPERATION_MODE_VLPS to enumeration LPM_OPERATION_MODE
  6. init_sci.c
    • Added settings for mode LPM_OPERATION_MODE_VLPS to the _bsp_sciX_operation_modes arrays for all the UARTs in the BSP
  7. lpm_smc.c
    • Added mode DOM_VLPS to LPM_PE_OPERATION_MODE_MAP[]
    • Disabled SPI0 clock gate when entering stop mode, otherwise stop entry is aborted.  Re-enabled clock gate after waking up.  If SPI0 peripheral is required in a stop mode, register the SPI driver with the LPM driver to properly configure when LPM changes operation mode to a stop mode.  Refer to LPM documentation for details.
    • Disabled the SysTick interrupt for the 5ms RTOS tick before entering stop mode, and re-enabled after waking up.  Without this, the example was entering VLPS mode fine without the debugger, but with the debugger the SysTick interrupt was causing VLPS entry to abort. 

Outcomes