# Interrupt Wrappers, etc.

**URL:** <https://forums.freertos.org/t/interrupt-wrappers-etc/4003>\
**Category:** Kernel\
**Created:** [March 17, 2015, 6:35am UTC](https://forums.freertos.org/t/interrupt-wrappers-etc/4003 "2015-03-17T06:35:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 17, 2015, 6:35am UTC](https://forums.freertos.org/t/interrupt-wrappers-etc/4003/1 "2015-03-17T06:35:19Z")

</div>

**[sfalias](https://sourceforge.net/u/sfalias/)** wrote on [Tuesday, March 17, 2015](https://sourceforge.net/p/freertos/discussion/382005/thread/b251b553/#7b42):

Hi,

In this post about counting sempahores:

[https://sourceforge.net/p/freertos/discussion/382005/thread/5e30e7e0/](https://sourceforge.net/p/freertos/discussion/382005/thread/5e30e7e0/)

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?

Thanks,

Dave

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [March 17, 2015, 10:59am UTC](https://forums.freertos.org/t/interrupt-wrappers-etc/4003/2 "2015-03-17T10:59:31Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Tuesday, March 17, 2015](https://sourceforge.net/p/freertos/discussion/382005/thread/b251b553/#fa76):

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

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 17, 2015, 3:58pm UTC](https://forums.freertos.org/t/interrupt-wrappers-etc/4003/3 "2015-03-17T15:58:16Z")

</div>

**[sfalias](https://sourceforge.net/u/sfalias/)** wrote on [Tuesday, March 17, 2015](https://sourceforge.net/p/freertos/discussion/382005/thread/b251b553/#d253):

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

Thanks,

Dave
