AT91SAM7S and RTT interrupt

denish0 wrote on Thursday, December 10, 2009:


I want to use the Real time Unit as 1s time interrupt and I have some problems with that.
I know that RTT and PIT (for tick generating) are sharing the same interrupt vector in AIC(System Controler), FreeRTOS uses the PIT interrupt. I modified port.c file, where is the ISR function of System Controler is:

    static __arm __irq void vPortNonPreemptiveTick( void );
static __arm __irq void vPortNonPreemptiveTick( void )
unsigned portLONG ulDummy;
unsigned int isr_pit;
unsigned int isr_rtt;


if (isr_pit & AT91C_PITC_PITS)

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

/* Clear the PIT interrupt. */


if (isr_rtt & AT91C_RTTC_RTTINC)





/* End the interrupt in the AIC. */
//AT91C_BASE_AIC->AIC_EOICR = ulDummy;

Whit this code rttc_isr() must  executing on every 1s. (RTTC_MR=0x8000), but not, As soom as i start running the code undefined instrunction execption hapens, and R14(LR) shows that undefined instruction executed from rttc_isr(), I also try whit context save and restore before, and after that function

-Here are my questions:

1. Is the any conseptions to use system controler interupts like DBGU,WDT, …. from FreeRTOS.
2. Where i do wrong whit this code.

thx guys.

Best regards.

denish0 wrote on Friday, December 11, 2009:

anyone :frowning:

incrediball wrote on Tuesday, December 22, 2009:

I don’t have an answer for your question but why do you want to use the RTT anyway? I have never understood the sense of this peripheral: it generates an inaccurate 1 second tick, so how is that useful?

Why not just use the tick hook routine and a counter, i.e. if you use a 1ms tick then count to 1000, then execute your code and reset the counter.