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] [November 2010 Threads] taskYIELD() causes hang inPIC24f interuptPosted by Sean on November 16, 2010 Per the FreeRTOS documentation to handle API calls inside of an interrupt I need to taskYIELD if necessary, I have the following ISR:
void __attribute__ ((__interrupt__, no_auto_psv)) _T4Interrupt(void) { portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; IFS1bits.T4IF = 0; xQueueSendToBackFromISR(queue_name, &queue_data, &xHigherPriorityTaskWoken);
if(xHigherPriorityTaskWoken == pdTRUE) { taskYIELD(); // Force context switch }
Everytime xHigherPriorityTaskWoken is true and the taskYIELD() executes, my processor resets. I've debugged to determine this is correct. If I comment out the taskYIELD, everything works smoothly.
The only thing I can think is that the priority of this interrupt is 7 and the tick timer has priority 1, but I'm not disabling any interrupts and per the RTOS docs this should be the correct method to use.
RE: taskYIELD() causes hang inPIC24f interuptPosted by Ricky on November 16, 2010 The correct function to use to switch tasks inside an interrupt is vTaskSwitchContext, not taskYield. So your code should look like this:
if(xHigherPriorityTaskWoken == pdTRUE) { vTaskSwitchContext(); // Force context switch }
RE: taskYIELD() causes hang inPIC24f interuptPosted by Richard on November 16, 2010 I think in this case calling taskYIELD() is the correct thing to do - but this must be done as the very last thing in the ISR routine. Is it the last line of executable code?
FreeRTOS\Demo\PIC24_MPLAB\serial\serial.c has an example ISR.
Regards.
RE: taskYIELD() causes hang inPIC24f interuptPosted by Sean on November 16, 2010 I've solved the problem. It turns out I was getting a stack overflow on my IDLE task. I had been assuming that the stack used for interrupts was from the task executing when the interrupt occurred which wouldn't have caused any stack issues.
Could someone shed some light on what consumes the IDLE task's stack during operation? (I have no user defined IDLE hook or anything that should be used during idle time).
(It looks like taskYIELD() is correct, when I switched it out with vTaskSwitchContext() I got strange behavior)
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|