FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [September 2006 Threads] FreeRTOS+lwIP Demo - timer int doesnt workPosted by Nobody/Anonymous on September 7, 2006 Hi, I'm trying to build my application based on FreeRTOS+lwIP Rowley Demo. Everything works fine with my AT91SAM7X256 board. Now I'm trying to write my own piece of code to understand how everything works. I tried to write timer interrupt and toggle a led with it. Code worked when I compiled it without FreeRTOS but when I try to implement it as a part of the system it doesnt work.
My timer init looks like that: void timer_init ( void ) //* Begin { portENTER_CRITICAL();
//* Open timer0 AT91F_TC_Open(AT91C_BASE_TC0,TC_CLKS_MCK8,AT91C_ID_TC0);
//* Open Timer 0 interrupt AT91F_AIC_ConfigureIt ( AT91C_ID_TC0, TIMER0_INTERRUPT_LEVEL,AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, timer0_c_irq_handler); AT91C_BASE_TC0->TC_IER = AT91C_TC_CPCS; // IRQ enable CPC //AT91F_AIC_EnableIt (AT91C_BASE_AIC, AT91C_ID_TC0); AT91C_BASE_AIC->AIC_IECR = 0x1 << AT91C_ID_TC0;
//* Start timer0 AT91C_BASE_TC0->TC_CCR = AT91C_TC_SWTRG ;
portEXIT_CRITICAL(); //* End }
And interrupt routine: void timer0_c_irq_handler(void) __attribute__ ((naked));
void timer0_c_irq_handler(void) { portENTER_SWITCHING_ISR();
portBASE_TYPE xSwitchRequired = pdFALSE; AT91PS_TC TC_pt = AT91C_BASE_TC0; unsigned int dummy; //* Acknowledge interrupt status dummy = TC_pt->TC_SR; //* Suppress warning variable "dummy" was set but never used dummy = dummy; count_timer0_interrupt++; //* Read the output state if ( (AT91F_PIO_GetInput(AT91C_BASE_PIOB) & LED1 ) == LED1 ) { AT91F_PIO_ClearOutput( AT91C_BASE_PIOB, LED1 ); } else { AT91F_PIO_SetOutput( AT91C_BASE_PIOB, LED1 ); } portEXIT_SWITCHING_ISR( xSwitchRequired ); }
Timer init is called from vBasicWEBServer thread. The problem is that TimerISR is entered only once and the led flashes but then it hangs. Other tasks work fine. I've lost many hours to fix it, maybe I dont understand something, but it should work and it doesnt.
RE: FreeRTOS+lwIP Demo - timer int doesnt workPosted by Nobody/Anonymous on September 7, 2006 You should send info to AIC that you finished interrupt service (eg. *AT91C_AIC_EOICR = 0;) before portEXIT_SWITCHING_ISR.
Janusz
RE: FreeRTOS+lwIP Demo - timer int doesnt workPosted by Nobody/Anonymous on September 7, 2006 Well... I'm blind %). How could I miss it while looking at EMAC_ISR example routine? :D Thanks for help, it works now :]
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|