Interrupt Wrappers, etc.

sfalias wrote on Tuesday, March 17, 2015:


In this post about counting sempahores:

there was a link to implementing interrupts. I’m using a PIC32MX and I believe I have a conflict between my UART and USB interrupts. When I don’t use USB, my UART receive interrupt works fine. With USB data going back and forth, somehow I get an occasional byte in my UART ISR which is corrupted.

I’m really confused about the max priority level in FreeRTS configuration and how I should configure the priorities of my ISRs.

My UART interrupt is defined as follows, I believe in agreement with the FreeRTOS requirements:

void attribute( (interrupt(IPL3SOFT), nomips16, vector(_UART2_VECTOR))) U2InterruptWrapper(void);

But my USB ISR is defined by the Microchip USB implementation as follows:

void attribute((interrupt(), vector(_USB_1_VECTOR))) _USB1Interrupt( void );

If I make USB priority 2, I get a general exception. If I make it 4, I still have the data corruption.

BTW, the corruption is weird. At random times, my receive data buffer has a byte replaced by the byte received 3 bytes prior to the current byte. It’s as if the buffer index is modified, and always by a 3 byte offset.

Any suggestions?



rtel wrote on Tuesday, March 17, 2015:

Are both interrupts using the FreeRTOS API, or just the UART interrupt?


sfalias wrote on Tuesday, March 17, 2015:

The USB interrupt does not use the FreeRTOS wrapper. I might try adding that in now.