I am using LPC812 and want to implement CHIBIOS/NIL (tick-less mode).
I have define CH_CFG_ST_TIMEDELTA to 2 (chconf.h), use MRT as timer, and enable CORTEX_ENABLE_WFI_IDLE (chcore_v6m.h).
Besides, I have one thread to be run and while(true) in main is empty.
Code: Select all
#include "ch.h"
#include "hal.h"
#include "SEGGER_RTT.h"
static void gptcb(GPTDriver *gptp){
(void) gptp;
palTogglePad(LPC_GPIO_PORT, LED_GREEN);
}
/**
* GPT configuration structure
*/
static const GPTConfig gptcfg = {
1000, /* Timer clock in Hz */
gptcb /* Timer callback */
};
/**
* Blinker thread #1.
*/
static THD_WORKING_AREA(waThread1, 128);
static THD_FUNCTION(Thread1, arg) {
(void)arg;
while (true) {
/* Perform processing here.*/
SEGGER_RTT_printf(0, "11\n");
chThdSleepSeconds(6);
}
}
/**
* Threads creation table, one entry per thread.
*/
THD_TABLE_BEGIN
THD_TABLE_THREAD(0, "blinker", waThread1, Thread1, NULL)
THD_TABLE_END
/**
* Application entry point.
*/
int main(void) {
/*
* System initializations.
* - Kernel initialization, the main() function becomes a thread and the
* RTOS is active.
*/
SEGGER_RTT_printf(0, "main\n");
halInit();
chSysInit();
/*
* Initialize the GPT driver1
*/
gptStart(&GPTD1, &gptcfg);
/*
* Start a continuous timer
*/
gptStartContinuous(&GPTD1, 2000);
/* This is now the idle thread loop, you may perform here a low priority
task but you must never try to sleep or wait in this loop. Note that
this tasks runs at the lowest priority level so any instruction added
here will be executed after all other tasks have been started.*/
while (true) {
}
}
The problem is I can see my thread just running once, right after flash. After sleep, the thread will not be executed again.
Is there any configuration that I missed out on? Where can I get the full reference to implement tick-less mode in CHIBIOS/NIL?
Thank you very much.