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


Interrupt stops scheduler - FreeRTOS 5.3.0

Posted by BugTraker on November 2, 2009
Hi all,

I'm running freertos on AT91SAM7S64. I run a system with few tasks (no interrupts yet): reading keypresses, using 1x16lcd, led blinking.
Now I want to add RTT, so interrupt has to be involved. Because I use GCC I use wrapper, and 'naked' all fine.
So, I let the system to run for ~10sec, all tasks switch ok, and when first RTT interrupt trings, the system stops switching tasks. But it does not crash. Last system settings are visible e.g. text on LCD, and RTT interrupt is working as programmed: it triggs every 1sec, and blinks LED. So my guess is that somehow my RTT irq disables the scheduler, how do I fix this?

RE: Interrupt stops scheduler - FreeRTOS 5.3.0

Posted by Richard on November 2, 2009
I would guess (and it is a guess) that the RTT interrupt is not being cleared correctly. It has to be cleared in both the RTT itself and also to AIC.

Does the RTT share the system interrupt, or does it have its own interrupt vector?


RE: Interrupt stops scheduler - FreeRTOS 5.3.0

Posted by BugTraker on November 3, 2009
That was helpful. RTT wasn't cleared properly, because it shared interrupt with SYS. So now I have modified SYS interrupt so that RTT is checked.
However, now system reboots randomly if I serve RTT in SYS irq without any function calls. If I do call a function that serves RTT then I get a data_abort.

As I said I use GCC, but no preemption, so do I have to SAVE and RESTORE context?
What bad can happen when other interrupt shares vector with SYS?

RE: Interrupt stops scheduler - FreeRTOS 5.3.0

Posted by Dave on November 3, 2009
Search far back in this forum, there have been threads on sharing the system interrupt before.

RE: Interrupt stops scheduler - FreeRTOS 5.3.0

Posted by BugTraker on November 4, 2009
I did search back, and a suggestion was made to add a 'dispacher' but in freertos 6.0 shared interrupts for SYS are still not supported.

RE: Interrupt stops scheduler - FreeRTOS 5.3.0

Posted by BugTraker on November 5, 2009
OK that is the thread I've found [SAM7S64 DBGU port as a UART][1]. All fine and I've done the same, but I'm still gettings random crashes. This is modified portISR:

void vNonPreemptiveTick( void )


unsigned portLONG ulDummy;

/* Increment the tick count - which may wake some tasks but as the

preemptive scheduler is not being used any woken task is not given

processor time no matter what its priority. */



/* End the interrupt in the AIC. */



The only difference is that I'm using non preemptive kernel.

[1]: http://sourceforge.net/projects/freertos/forums/forum/382005/topic/1351935

RE: Interrupt stops scheduler - FreeRTOS 5.3.0

Posted by BugTraker on November 11, 2009
Found the problem - spurious interrupt. For whatever reason PIT and RTT together where causing spurious irqs.

In pvrSetupTimerInterrupt() I have added` AT91C_BASE_AIC->AIC_SPU = AT91C_BASE_AIC->AIC_SVR[AT91C_ID_SYS];`
And that fixed the problem. I will change this to specific spurious irq handler, but for time being it does the job - system does not crash at all.

RE: Interrupt stops scheduler - FreeRTOS 5.3.0

Posted by Jon Newcomb on July 22, 2010
Out of interest, what did you set you default handler to?

In the end I created my own..
__irq __arm void

(For IAR). but I'm not sure how to test it.. or if it is going to upset FreeRTOS..

Found the following, but can't see how the provided solution works.. (no __irq keyword..)
(Title: "Odd interrupt enabling / disabling issues causing chip reset")

[ 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