Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


[PIC32] using ISR before the scheduler start

Posted by Angelo on February 16, 2012
I'm working on an application that use two timers.
The firts timer is set to priority 7 while the second is set to priority 6.
i need the isr to be raised before the start of the the os scheduler so I initialize the interrupt before declaring any tasks.
I encounter a strange behavior changing the value of configMAX_SYSCALL_INTERRUPT_PRIORITY.
Setting it on 0x7 i get both the isr to work correctly "after" the scheduler start.
If i set it on a value lower than 6 i get them to work correctly "before" the scheduler start.
What i'm doing wrong?
Thanks in advance for any help.

RE: [PIC32] using ISR before the scheduler start

Posted by Angelo on February 16, 2012
I found that a possibly cause of my problem is the freertos interrupt masking.
In fact if i set configMAX_SYSCALL_INTERRUPT_PRIORITY = 7 it mask my two timer whose priorities are 7 and 6.
So there is a way to unmask interrupts before the scheduler starts?
I need to do something like that:
int main(void)
// my function that wait for timers interrupts raising...



Thanks again!

RE: [PIC32] using ISR before the scheduler start

Posted by Richard on February 16, 2012
In the general case, it is not good to allow interrupts to execute before the kernel is started. That is because there is potential for a crash if the ISR attempts to call a FreeRTOS API function before the scheduler has started - or even worse, attempts a context switch (the latter case will definitely cause a crash). Therefore, FreeRTOS API functions will return with interrupts masked to the defined max syscall priority when they are called before the scheduler is started. For example, calling xTaskCreate() before the scheduler is started will result in interrupts being masked.

You can manually unmask the interrupt by calling taskENABLE_INTERRUPTS(), but interrupts will be masked again if another FreeRTOS API function is called before vTaskStartScheduler().


RE: [PIC32] using ISR before the scheduler start

Posted by Angelo on February 17, 2012
Thanks a lot!
It works perfectly.

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner