I ‘am using Chibi 2.6.3 and have question about the CPU usage. I’ve set up a small project on a Spansion 16FX to test the kernel. The Project has 3 Thread, where the first Thread just counts a 7 Segment Display up. The second thread drives an online Protocol for interfacing a PC Program by the serial port, the third Thread reads out the Idle loop count (u32IdleCnt ) that can be displayed at the PC. The main function will become the Idle Thread, ChibiOS Idle Thread is turned off in the configuration. This setup works properly and the setup reports about 47,7 million idle cycles on a 48 MHz MCU, which is an expected value. It must be noticed that the fSekSchleife Thread has the Priority Level LOWPRIO+14. When I set this value to LOWPRIO+13 or below, so the reported idle cycles will drop to about just 39 million cycles, without changing anything else.
What is the difference between LOWPRIO+13 and LOWPRIO+14 in my setup? Anyhow watching the idle loop with a scope does not report really more CPU load between the two setups.
BTW: Is there a common way to measure remain CPU time?
regards,
logan54
Code: Select all
void main(void)
{
… I/O Inits …
__set_il(0); /* disallow all levels */
chSysInit(); /* __EI(); globally enable interrupts will be called inside chSysInit */
chThdCreateStatic( strVarPassDemoWA , sizeof(strVarPassDemoWA) ,LOWPRIO+1, (tfunc_t)&VarPassDemo ,NULL);
thread_ptr_netlink = chThdCreateStatic( strNetLinkWA , sizeof(strNetLinkWA) ,LOWPRIO+2, (tfunc_t)&NET_Link , NULL );
chThdCreateStatic( strSekSchleife , sizeof(strSekSchleife) , LOWPRIO+14, (tfunc_t)&fSekSchleife , NULL );
chThdSetPriority(IDLEPRIO); /* Diese Schleife ist der IDLE Thread */
__set_il(7); /* allow all levels */
for(;;)
{
u32IdleCnt++;
}
}
static msg_t VarPassDemo ( void* arg )
{
systime_t time;
time = chTimeNow(); // T0
for(;;)
{
time += MS2ST(1000u); // 1000 ms Intervall
// --- Sicher und Rücksetzen des Idle Loop Zählers
//PDR00_P7 = 0;
chThdSleepUntil(time);
//PDR00_P7 = 1;
}
return (msg_t)0; // should be never reached!
}
uint32_t u32cyclesRemain;
static msg_t fSekSchleife ( void* arg )
{
systime_t time;
time = chTimeNow(); // T0
for(;;)
{
time += MS2ST(1000u); // 1000 ms Intervall
// --- Sicher und Rücksetzen des Idle Loop Zählers
u32cyclesRemain = u32IdleCnt;
u32IdleCnt = 0UL;
PDR00_P7 = ~PDR00_P7;
chThdSleepUntil(time);
}
return (msg_t)0; // should be never reached!
}