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. modify user_config.h #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. modify BSP_DEFAULT_IO_CHANNEL in twrk20d72,.h as below: #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 modify LPM_CPU_OPERATION_MODES[] in init_lpm.c as below: 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 add following code in _kuart_int_rx_tx_isr() from serl_int_kuart.c 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. replace main.c in "C:\Program Files\Freescale\MQX_4_0_2\mqx\examples\lowpower" with the attached one. 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
View full article