Hangs on PIC32 uxPortSetInterruptMaskFromISR

l4na wrote on Monday, July 22, 2013:

Hi, I just started using FreeRTOS ( PIC32 ) and got an issue once I call xSemaphoreGiveFromISR. I call this API from an interrupt that is set to priority 1. I narrow down the hang to the uxPortSetInterruptMaskFromISR, when it tries to _CP0_SET_STATUS. Couple of questions :
1. uxSavedStatusRegister = _CP0_GET_STATUS() | 0x01;
Is this call really needed?  when the interrupt happens, the IE bit should already set unless it is disable by the “asm volatile (“di”)” ? Any idea what might cause the hang? What puzzling is the Timer tick interrupt is also running with priority 1 and it has no issue.

2. portALL_IPL_BITS is set to 0x3fUL. From what I read in PIC32 spec, the IPL bits are bit 10-12 (3bits), shouldn’t this value be 0x7UL ?


l4na wrote on Monday, July 22, 2013:

Some update on issue 1, I found out the hang is caused by the interrupt bit is not yet cleared when I call that function.  So as long as I clear the interrupt bit before calling the uxPortSetInterruptMaskFromISR , everything works fine.

rtel wrote on Monday, July 22, 2013:

Are you following the instructions in the “Interrupt Service Routines” section of the following page: http://www.freertos.org/port_PIC32_MIPS_MK4.html ?  You should never find interrupts are disabled inside the interrupt handler unless you disabled them.