Quality RTOS & Embedded Software

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


Loading

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?

Regards.

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. */

if (0 != (AT91C_BASE_PITC->PITC_PISR & AT91C_PITC_PITS))
{
vTaskIncrementTick();

ulDummy = AT91C_BASE_PITC->PITC_PIVR;

}
if (0 != (AT91C_BASE_RTTC->RTTC_RTSR & AT91C_RTTC_RTTINC))
{
ulDummy = AT91C_BASE_RTTC->RTTC_RTSR;
ulDummy = AT91C_BASE_RTTC->RTTC_RTVR;
}
/* End the interrupt in the AIC. */

AT91C_BASE_AIC->AIC_EOICR = 0;

}

`
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
AT91F_Spurious_handler(void)
{
AT91F_AIC_AcknowledgeIt(AT91C_BASE_AIC);
return;
}

(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..)
http://www.at91.com/forum/viewtopic.php/f,15/t,3180/
(Title: "Odd interrupt enabling / disabling issues causing chip reset")


[ 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.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

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.


Careers

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

Renesas

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