Semaphore Execution time

sindhukrishnan wrote on Wednesday, October 28, 2015:

Hello FreeRTOS Team

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 ?

rtel wrote on Wednesday, October 28, 2015:

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:
http://www.freertos.org/vTaskNotifyGiveFromISR.html

Regards.

sindhukrishnan wrote on Wednesday, October 28, 2015:

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.

rtel wrote on Wednesday, October 28, 2015:

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.

Regards.

sindhukrishnan wrote on Wednesday, October 28, 2015:

I use Cortex R5F (TMS570LC4357) and I donot find the documentation for this particular port

rtel wrote on Wednesday, October 28, 2015:

The quick start guide shows you how to locate the documentation:
http://www.freertos.org/FreeRTOS-quick-start-guide.html

although I believe the code TI are shipping is slightly different to
that in the FreeRTOS zip file download.

The web server seems very slow at the moment…hopefully that is a
temporary glitch.

Regards.

sindhukrishnan wrote on Wednesday, October 28, 2015:

I find only Cortex R4F port available in Supported devices in the above link. Will FreeRTOS provide port for Cortex R5F in the near future?

sindhukrishnan wrote on Wednesday, October 28, 2015:

May I know what are the possible conditions that causes Scheduler to Suspend itself when running FreeRTOS code ?

rtel wrote on Wednesday, October 28, 2015:

I’m not sure that, from the perspective of the RTOS, there is a
difference between the two
(http://www.arm.com/products/processors/cortex-r/cortex-r5.php). Would
you disagree? I know WITTENSTEIN have supplied OpenRTOS for both.

Regards.