FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [February 2010 Threads] Call to xTaskGetTickCount in an ISRPosted by J Recas on February 25, 2010 Hi guys
I have noticed that if you call xTaskGetTickCount inside an interrupt, the FreeRTOS (for msp430) stops working. I think this is due to the portENTER_CRITICAL(); / portEXIT_CRITICAL(); inside xTaskGetTickCount, because the interrupts should no be enabled in any case inside my ISR.
Can be this a bug in the msp430 port? should I implement a new funtion (xTaskGetTickCountFromISR) that just return the tickcounter without enter/exit critical?
Thanks!
RE: Call to xTaskGetTickCount in an ISRPosted by Dave on February 25, 2010 No this is not a bug but the expected behavior. The rule is, if the function does not end in "FromISR" then don't call it from an ISR.
The critical section is necessary on the MSP430 if you have configUSE_16_BIT_TICKS set to 0, which would be normal. When this is so the tick count is 32 bits but the processor is only 16 bits so accesses will never be atomic.
If you protect the tick count with the critical section when you are executing tasks then you should just be able to access the variable directly when you are executing interrupts but you might have to remove its static qualification. Or you could provide a FromISR version of xTaskGetTickCount() that does not have the critical section.
RE: Call to xTaskGetTickCount in an ISRPosted by J Recas on February 25, 2010 I understand why the critical section is necessary, but I didn't know that functions without FromISR can not be called inside an ISR.
I will implement the new FromISR version.
Thank you!!
RE: Call to xTaskGetTickCount in an ISRPosted by J Recas on February 25, 2010 BTW in the msp430 implementation taskYIELD() does not have a FromISR and is called in the Usart Rx ISR. It is safe to use it inside an interrupt? And can be called inside a function that has been called from an ISR? I mean, the ISR calls a function that, after sending some data through a queue (using send From ISR) may need taskYIELD().
RE: Call to xTaskGetTickCount in an ISRPosted by Richard on February 25, 2010 “BTW in the msp430 implementation taskYIELD() does not have a FromISR and is called in the Usart Rx ISR.” If that is what the official demo is doing then it will be fine - however this does not hold true for all ports, some of which have a different yield function or mechanism for use inside an interrupt. Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|