I use TMS570LC4357 HDK with FreeRTOS, HALCoGen v4.5.1 for Code generation and CCSv6 as IDE.
I use Counting Semaphore to handle an Interrupt task. I’ve configured the Semaphore queue size as 100 and the waiting time for Semaphore as 1 tick.
When I run the code, the time taken between xSemaphoreGiveFromISR( xSemaphore, &xHigherPriorityTaskWoken ); inside the ISR and the if(xSemaphoreTake( xSemaphore, 0x01 ) == pdTRUE) inside the ISR Handler is 880ms. Also I face a Jitter in the task that runs cyclically every 1ms. Does Counting Semaphore execution time take 880ms?
Which of these consume the least exection time in event handling
i) Counting Semaphore
ii) Binary Semaphore
iii) Event Group ?
When I run the code, the time taken between xSemaphoreGiveFromISR( xSemaphore, &xHigherPriorityTaskWoken ); inside the ISR and the if(xSemaphoreTake( xSemaphore, 0x01 ) == pdTRUE) inside the ISR Handler is 880ms
That sounds exceptionally long.
Q1 Are you using the xHigherPriorityTaskWoken parameter to request a context switch inside the ISR?
Q2 Does the task you are unblocking have a priority above the priority of the currently running task (the task the ISR interrupted)?
Which of these consume the least exection time in event handling
Actually the least amount of time will be a direct to task notification, which you can use in exactly the same way as either a binary or counting semaphore. Look at the example code on the following page:
For Q1, yes I did use xHigherPriorityTaskWoken parameter. Is NULL sufficient for use there?
For Q2, the Unblocking task has the highest priority of all tasks.
yes I did use xHigherPriorityTaskWoken parameter. Is NULL sufficient for use there
No - if you pass in NULL then it means you are not using it. Please read the documentation for the port you are using, and the API documentation for the functions you are using in the interrupts.