# PIC32MX Interrupt crashes system

**URL:** <https://forums.freertos.org/t/pic32mx-interrupt-crashes-system/8818>\
**Category:** Microchip\
**Created:** [February 16, 2020, 4:33pm UTC](https://forums.freertos.org/t/pic32mx-interrupt-crashes-system/8818 "2020-02-16T16:33:49Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![SergentSloGin](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/sergentslogin/32/48_2.png) [@SergentSloGin](https://forums.freertos.org/u/SergentSloGin)\
**Post date:** [February 19, 2020, 11:02am UTC](https://forums.freertos.org/t/pic32mx-interrupt-crashes-system/8818/18 "2020-02-19T11:02:50Z")

</div>

Hi Robert,

portYIELD\_FROM\_ISR is defined in portmacro.h which resides under FreeRTOS\Source\include\portable\MPLAB\PIC32MX

The same folder contains ISR\_Support.h which is included in the assembler files.

I tend to keep the ISR wrappers in separate assembler files along with the “peripheral” C code.  
Putting all the interrupt wrappers in a single file also works, just makes it slightly less transferable between projects.

My version of a change notification ISR:

```
void __attribute__ ( (interrupt(IPL0AUTO), vector(_CHANGE_NOTICE_VECTOR))) vChangeNotificationInterruptWrapper( void );
void vChangeNotificationInterruptHandler( void )
{
    BaseType_t bTaskWasWoken = pdFALSE;
    IFS1CLR = _IFS1_CNIF_MASK; // Clear the interrupt
    // post a message to a queue with bTaskWasWoken changed by the call
    portYIELD_FROM_ISR(bTaskWasWoken);
}

```

Note that the interrupt priority (IPL0AUTO) is irrelevant here, the priorities are set in the IPCx registers.

Jean

---

_[View the full topic](https://forums.freertos.org/t/pic32mx-interrupt-crashes-system/8818)._
