Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

[PIC32] using ISR before the scheduler start

Posted by Angelo on February 16, 2012
Hello!
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)
{
unmaskinterrupts();
// my function that wait for timers interrupts raising...
maskinterrupts();

createtasks();

vTaskStartScheduler();
}

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().

Regards.

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 ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists