Hi Freescale Community,
I recently managed to run MQX (4.0.2) on a custom board based on K10 (50 MHz silicon) device.
This board is dedicated to measuring chip consumption so I wanted to activate Low Power mode for MQX.
Looking at Idle task code and mqx.h, I found something that doesn't seem to make sense.
In src/include/mqx.h (line 162):
#define MQX_IDLE_TASK_PARAMETER 0
#if (MQX_USE_IDLE_TASK) && (MQX_ENABLE_LOW_POWER) && (MQX_IDLE_TASK_PARAMETER != 0)
#error MQX_IDLE_TASK_PARAMETER must be 0 when Low Power feature is enabled!
#endif
And in src/kernel/idletask.c:
void _mqx_idle_task
(
uint_32 parameter
)
{ /* Body */
[...]
while (1) {
[...]
#if MQX_ENABLE_LOW_POWERif (parameter)
{
_ASM_SLEEP();
}
#endif
} /* Endwhile */
} /* Endbody */
If I understand this well, mqx.h forces me to let MQX_IDLE_TASK_PARAMETER to 0 while idle task will test this parameter to be not 0 to enter wait mode.
So basically, I can not enter wait mode in idle task unless I modify idletask.c.
Do I miss something here ?
Thank you in advance for those who will read and discuss this point.
Tybos
Looking at mqx/examples/lowpower, everything makes sense !
Low power driver (io/lpm/lpm.c) defines a routine
_mqx_uint _lpm_idle_sleep_setup
(
/* [IN] Whether to turn on/off the idle sleep feature */
boolean idle_sleep
)
that restarts Idle task (if needed) with updated parameter.
I only need to call _lpm_idle_sleep_setup(TRUE) at beginnning of my task to allow entering wait mode.