This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Stellaris UART1 Interrupt priority relative to freeRTOS task priority

How do I determine the Stellaris UART1 interrupt priority relative to a freeRTOS task priority (of 1)?
The freeRTOS port is for CCS for the Stellaris processors.
In the freeRTOS port you set the priority of a task when you creat it (higher numbers are higher priority).

When you set up the interrupt routine for the UART you just put the function name in the correct location in the interrupt table.
But I don't see how to correlate the two.  In my case, the  UART1 interrupt function is the 22nd one in the table and I set the other task in to '1' when i  created it.
So, which has a higher priority?

Can anybody help me with this?

thanks,
Tim.

  • I don't really understand your question.  Interrupt priorities and task priorities are not related in any way.  

    Interrupt priorities are controlled by the hardware and effect which interrupt runs when.  Interrupts are not tasks, but can communicate with tasks.  You *must* set the interrupt priority in your code (by calling the provided StellarisWare or CMSIS library functions) if you want the interrupt service routine to call any interrupt safe FreeRTOS functions (those that end in "FromISR").   See the "RTOS Port specific configuration" section on any of the Stellaris documentation pages on the FreeRTOS.org web site for information on configuring valid interrupt priorities  For example, this page http://www.freertos.org/portlm3sx965.html - there is also more information here: http://www.freertos.org/a00110.html#kernel_priority and item number three here http://www.freertos.org/FAQHelp.html .

    Task priorities are set when the task is created, but can be changed at any time the scheduler is running too (using the FreeRTOS API).  Task priorities control which task runs when, when no interrupts are executing.

    This is also explained in the Cortex-M3 version of the FreeRTOS tutorial book, which comes with Stellaris examples.  http://www.freertos.org/Documentation/FreeRTOS-documentation-and-book.html

    Regards.

  • Thank you. 
    I didn't understand it enough to ask the question properly.  Your response does give me the information I need.
    I wasn't calling "IntPrioritySet()", so I think the priority of the interrupt I was using (default) was too high, which was causing the program to crash when I called a _FromISR() function from within the interrupt. 

    Unfortunately, I bought the "Standard Edition" of the freeeRTOS book, so I don't have access to the stellaris examples in the book. 
    I did find these two lines in FreeRTOSConfig.h

    #define configKERNEL_INTERRUPT_PRIORITY         ( 7 << 5 )  /* Priority 7, or 255 as only the top three bits are implemented.  This is the lowest priority. */
    #define configMAX_SYSCALL_INTERRUPT_PRIORITY    ( 5 << 5 )  /* Priority 5, or 160 as only the top three bits are implemented. */ 

    This along with the link you pointed to:
    http://www.freertos.org/index.html?http://www.freertos.org/a00110.html#kernel_priority 
    and I think I've got it figured out.

    Unfortunately, I can't try  it out now, since for some reason the CCS4 debugger won't recognize the ek-lm3s6965 board any more, so  I'm kind of stuck.  It just stopo connecting to the board properly.  "Error connecting to the target" is all I get. 

    Anyway, thanks for your help.

    Tim.

    Update:  I got the board working again (with Debug Port Unlock in LM Flash Programmer) and setting the priority of the UART interrupt works great!  I just used:

    IntPrioritySet(INT_UART1, configMAX_SYSCALL_INTERRUPT_PRIORITY );

    in before enabling the inerrupt.