mrbietola wrote on Thursday, September 20, 2018:
Hi, i’m using Microblaze. My freertos tick is 10ms.
I have 2 tasks. One of them send a synch to a camera every 20 ms (50 Hz rate)
The other task should be awaken by an event, so i used ulTaskNotifyTake with a timeout. Now i’m not sending this event so the timeout runs every 30 ms.
I see that in these conditions my frame rate drops from 50 Hz to 44-47 Hz in the other task.
If i remove the xTaskNotifyWait and use a vTaskDelayUntil() , the problem disappears.
I would like to know if there is an issue with TaskNotify, can i use something else?
If i change the tick period to 5 ms, i reach 48-49 Hz but it’s still wrong!
Here are some snippets:
Camera task run a 5ms, but with a counter i send the synch every 20ms
void ir_tx_rx_task(void *pvParameters)
{
TickType_t xNextWakeTime;
// Initialize xNextWakeTime - this only needs to be done once.
xNextWakeTime = xTaskGetTickCount();
for(;;)
{
// Place this task in the blocked state until it is time to run again, 5 ms
vTaskDelayUntil( &xNextWakeTime, IR_TX_PERIOD_MS );
//
ir.counter++;
if(ir.counter==4 || ir.counter==8){
send_synch();
}
if(ir.counter==8){ //transmits every 40ms
ir.counter=0;
}
}
The task with notify that causes problems, it should be notified every 20 ms, now i’m not notifing so it should run every 30 ms:
void funnel_tx_task(void *pvParameters)
{
const TickType_t xInterruptFrequency = pdMS_TO_TICKS( 20UL ); //IR Frame period
/* xMaxExpectedBlockTime is set to be a little longer than the maximum expected time
between events. */
const TickType_t xMaxExpectedBlockTime = xInterruptFrequency + pdMS_TO_TICKS( 10 );
for( ;; )
{
if( ulTaskNotifyTake( pdTRUE, xMaxExpectedBlockTime ) != 0 ) {
funnel_command_manager();
funnel_put_data();
}
else {//Notify not arrived in time, should run with timeout set by xMaxExpectedBlockTime
funnel_command_manager();
funnel_put_data();
}
}