nikhilkalige wrote on Wednesday, February 29, 2012:
Th priorities given is as follows
#define mainTIME_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
#define mainMEMS_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainDEBUG_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
portTASK_FUNCTION( vTimeTask, pvParameters ) {
portTickType xLastWakeTime;
uint8_t i=0;
xLastWakeTime = xTaskGetTickCount();
for(;
{
// Once per second, copy the number of idle ticks and then
// reset the rolling counter.
if ( ++i == 20 ) {
i = 0;
u64IdleTicks = u64IdleTicksCnt;
u64IdleTicksCnt = 0;
}
vTaskDelayUntil( &xLastWakeTime, ( 50 / portTICK_RATE_MS ) );
}
}
void vApplicationTickHook( void ) {
++u64Ticks;
}
portTASK_FUNCTION( vDebugTask, pvParameters ) {
char ch;
portBASE_TYPE xStatus;
//uint16_t u16StackSize;
/* The parameters are not used. */
( void ) pvParameters;
vDebugString( “Debug task started.\r\n”);
for(;
{
// As long as there are characters in the queue fifo this code should
// pop them out and send them as quick as possible out the UART.
if( USART_GetFlagStatus( USART2, USART_FLAG_TXE ) ) {
// We don’t want to block forever - need to check on Rx too.
xStatus = xQueueReceive( xDebugQueue, &ch, 10 / portTICK_RATE_MS );
if( xStatus == pdPASS ) USART_SendData( USART2, ch );
}
if ( USART_GetFlagStatus( USART2, USART_FLAG_RXNE ) ) {
ch = USART_ReceiveData( USART2 );
// Handle Debug Console Commands Here.
switch ( ch ) {
// Alphabetical list of commands the console debugger responds to.
case ‘m’:
vDebugPrintf( “Mems dump Stopped.\r\n”);
vSetMemsDump( false );
break;
case ‘M’:
vDebugPrintf( “Mems dump Started.\r\n”);
vSetMemsDump( true );
break;
case ‘a’:
vDebugPrintf( “AtoD dump Stopped.\r\n”);
//vSetAtoDDump( FALSE );
break;
case ‘A’:
vDebugPrintf( “AtoD dump Started.\r\n”);
//vSetAtoDDump( TRUE );
break;
case ‘l’:
vDebugPrintf( “Loop Count Stopped.\r\n”);
//vSetCntLoops( FALSE );
break;
case ‘L’:
vDebugPrintf( “Loop Count Started.\r\n”);
//vSetCntLoops( TRUE );
break;
// Print out how much stack space remains on each task stack.
case ‘s’:
vDebugPrintf( “Remaining space on Task Stack:\r\n” );
//u16StackSize = uxTaskGetStackHighWaterMark( hDebugTask );
//vDebugPrintf( “Debug\t%d\r\n”, u16StackSize);
//u16StackSize = uxTaskGetStackHighWaterMark( hTimeTask );
//vDebugPrintf( “Time\t%d\r\n”, u16StackSize);
//u16StackSize = uxTaskGetStackHighWaterMark( hLCDTask );
//vDebugPrintf( “LCD\t%d\r\n”, u16StackSize);
break;
// Add general test code here…
case ‘t’:
break;
default:
break;
}
}
taskYIELD();
}
}
i have attached the code above…… i found by profiling that the amount of time spent in vApplicationTickHook is about 35% when the debug task runs for only .1%. But as u mentioned since the debug task is higher the app.hook task shouldn’t it be running all the time and not yielding to the vApplicationTickHook???