# FreeRTOS Interrupt with Arduino Due Cortex-M3

**URL:** <https://forums.freertos.org/t/freertos-interrupt-with-arduino-due-cortex-m3/947>\
**Category:** Kernel\
**Created:** [March 18, 2013, 8:09pm UTC](https://forums.freertos.org/t/freertos-interrupt-with-arduino-due-cortex-m3/947 "2013-03-18T20:09:16Z")\
**Posts on this page:** 2\
**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 18, 2013, 8:09pm UTC](https://forums.freertos.org/t/freertos-interrupt-with-arduino-due-cortex-m3/947/1 "2013-03-18T20:09:16Z")

</div>

**[arduino2012](https://sourceforge.net/u/arduino2012/)** wrote on [Monday, March 18, 2013](https://sourceforge.net/p/freertos/discussion/382005/thread/2d586eda/#7501):

Hi,  
I want to learn about how to implement interrupt in freeRTOS. I am using the Arduino Due SAM3X8E Cortex-M3 microcontroller. Have somebody used an interrupt in freeRTOS which you could share with me. Is there any guide of how to implement interrupt in freeRTOS. I have read alot in the freeRTOS website but I have not found any guide.

---

<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 18, 2013, 8:34pm UTC](https://forums.freertos.org/t/freertos-interrupt-with-arduino-due-cortex-m3/947/2 "2013-03-18T20:34:30Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, March 18, 2013](https://sourceforge.net/p/freertos/discussion/382005/thread/2d586eda/#75a5):

Writing FreeRTOS aware interrupts on a Cortex-M chip is actually very simple as, unlike when doing the same on their ARM7 predecessors, there are not special requirements **other than** ensuring you have the priorities set correctly.&nbsp; Basically, just write a standard C function and install it in the vector table.

See the “Interrupt Service Routines” section of the following page.&nbsp; Most (if not all) official demos have examples included too.

[http://www.freertos.org/Atmel\_SAM3\_SAM3X-EK\_SAM3S-EK2\_RTOS\_Demo.html](http://www.freertos.org/Atmel_SAM3_SAM3X-EK_SAM3S-EK2_RTOS_Demo.html)

The important bits:&nbsp;

1) If an interrupt is going to use a FreeRTOS API function then, as with all the FreeRTOS ports, only the API functions that end in FromISR can be used (see the last bullet point at the top of the following page for the rationale: [http://www.freertos.org/Embedded-RTOS-Queues.html).](http://www.freertos.org/Embedded-RTOS-Queues.html%29.)

2) FreeRTOS Cortex-M ports implement a full interrupt nesting model, the behaviour of which is configured using two FreeRTOSConfig.h constants:&nbsp; configMAX\_SYSCALL\_INTERRUPT\_PRIORITY and configKERNEL\_INTERRUPT\_PRIORITY.&nbsp; Interrupt safe FreeRTOS functions can only be called from interrupts that have a priority at or below that set by configMAX\_SYSCALL\_INTERRUPT\_PRIORITY (if CMSIS priority functions are being used then configLIBRARY\_MAX\_SYSCALL\_INTERRUPT\_PRIORITY).&nbsp;

See [http://www.freertos.org/RTOS-Cortex-M3-M4.html](http://www.freertos.org/RTOS-Cortex-M3-M4.html) for the full explanation.

Regards.
