The MQX 4.0.2 BSP doesn't support VLPS mode out of box, and RXEDGE interrupt is not enabled either, so there are several steps to do before implementing the demo.
#define BSPCFG_ENABLE_TTYB 0
#define BSPCFG_ENABLE_ITTYB 1
MQX enables UART in polled mode by default, and here we enable the UART1 interrupt mode, the TTY port may vary depending on the platform.
#ifndef BSP_DEFAULT_IO_CHANNEL
#if BSPCFG_ENABLE_ITTYB
#define BSP_DEFAULT_IO_CHANNEL "ittyb:" /* OSJTAG-COM interrupt mode */
#define BSP_DEFAULT_IO_CHANNEL_DEFINED
#else
#define BSP_DEFAULT_IO_CHANNEL NULL
#endif
const LPM_CPU_OPERATION_MODE LPM_CPU_OPERATION_MODES[LPM_OPERATION_MODES] = {
// LPM_OPERATION_MODE_RUN
{
LPM_CPU_POWER_MODE_RUN, // Index of predefined mode
0, // Additional mode flags
0, // Mode wake up events from pins 0..3
0, // Mode wake up events from pins 4..7
0, // Mode wake up events from pins 8..11
0, // Mode wake up events from pins 12..15
0 // Mode wake up events from internal input sources
},
// LPM_OPERATION_MODE_WAIT
{
LPM_CPU_POWER_MODE_VLPS,//LPM_CPU_POWER_MODE_VLPR, // Index of predefined mode
0, // Additional mode flags
0, // Mode wake up events from pins 0..3
0, // Mode wake up events from pins 4..7
0, // Mode wake up events from pins 8..11
0, // Mode wake up events from pins 12..15
0 // Mode wake up events from internal input sources
},
// LPM_OPERATION_MODE_SLEEP
{
LPM_CPU_POWER_MODE_WAIT, // Index of predefined mode
LPM_CPU_POWER_MODE_FLAG_SLEEP_ON_EXIT, // Additional mode flags
0, // Mode wake up events from pins 0..3
0, // Mode wake up events from pins 4..7
0, // Mode wake up events from pins 8..11
0, // Mode wake up events from pins 12..15
0 // Mode wake up events from internal input sources
},
// LPM_OPERATION_MODE_STOP
{
LPM_CPU_POWER_MODE_LLS, // Index of predefined mode
0, // Additional mode flags
0, // Mode wake up events from pins 0..3
0, // Mode wake up events from pins 4..7
0, // Mode wake up events from pins 8..11
0, // Mode wake up events from pins 12..15
LLWU_ME_WUME0_MASK // Mode wake up events from internal input sources - LPT
}
};
Here we map LPM_OPERATION_MODE_WAIT to VLPS mode
if (sci_ptr->S2 & UART_S2_RXEDGIF_MASK)
{
sci_ptr->S2 = UART_S2_RXEDGIF_MASK;
sci_ptr->BDH &= 0xBF; /* clear RXEDGIE */
}
so that RXEDG event is checked in _kuart_int_rx_tx_isr() for low power mode.
After recompiling MQX libs as well as the low power demo, you may test the VLPS mode just as shown in the attached video.
Hope that helps,
B.R
Kan
Original Attachment has been moved to: VLPS-test.7z.zip
Original Attachment has been moved to: main.c.zip
Original Attachment has been moved to: serl_int_kuart.c.zip
Original Attachment has been moved to: user_config.h.zip
Original Attachment has been moved to: init_lpm.c.zip