FreeRTOS Support ArchiveThe FreeRTOS support forum is used to obtain support directly from Real Time Engineers Ltd.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.
Interrupt handling in FreeRTOSPosted by Bart on June 6, 2010 Hi, I'm wondering if there is a special mechanism for handling interrupts in FreeRTOS? I wanted to write a simple interrupt routine that would toggle a led when I press a button. But sadly, when I add the interrupt initialization code, the task won't start. Here's the code:
void vStartLEDFlashTasks()
As you can see it's very simple. I'm using SAM7-P64 dev board. Am i doing it wrong? RE: Interrupt handling in FreeRTOSPosted by Bart on June 6, 2010 It seems like the line :
is the problem. If I comment it, the task is running and everything is ok. How should I handle the interrupt then? RE: Interrupt handling in FreeRTOSPosted by Rohit Grover on June 6, 2010 Try enabling your interrupt only after the freeRTOS scheduler gets started. In your FreeRTOS port, isn't there a sample serial driver using interrupts which can help as a reference? RE: Interrupt handling in FreeRTOSPosted by Bart on June 8, 2010 Hi, I bought the manual and changed my code, but interrupts still don't work. Everything seems to be ok. Is the ISR written correctly?
Here's the task that takes the semaphore:
RE: Interrupt handling in FreeRTOSPosted by Richard Damon on June 8, 2010 Not familiar with this processor, but the line AT91C_BASE_AIC->AIC_EOICR = 0xFA; would be my guess at the error. I presume this is an end of interrupt control, and probably doesn't want to be conditioned on xHigherPriorityTaskWoken. I would suggest placing it before the if statement. RE: Interrupt handling in FreeRTOSPosted by Bart on June 8, 2010 I got it working. It seems that an interrupt handler that gives a token to a semaphore needs to be called from a wrapper that copies the context. I got it working with:
Now, correct me if I'm wrong, but that is the only way I managed to get it done. Without the wrapper the processor "hangs" itself. And of course both the wrapper and the handler must be compiled in ARM mode. Or is there a way without using a wrapper? RE: Interrupt handling in FreeRTOSPosted by Richard on June 8, 2010 If your interrupt is wanting to cause a context switch, or wanting to call a FreeRTOS API function, then the wrapper is required - as per the documentation and examples.
|
|
来自: 迎风初开 > 《freertos》