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


FreeRTOS+lwIP Demo - timer int doesnt work

Posted by Nobody/Anonymous on September 7, 2006
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

//* Open timer0

//* Open Timer 0 interrupt
//AT91F_AIC_EnableIt (AT91C_BASE_AIC, AT91C_ID_TC0);

//* Start timer0

//* End

And interrupt routine:
void timer0_c_irq_handler(void) __attribute__ ((naked));

void timer0_c_irq_handler(void)

portBASE_TYPE xSwitchRequired = pdFALSE;
unsigned int dummy;
//* Acknowledge interrupt status
dummy = TC_pt->TC_SR;
//* Suppress warning variable "dummy" was set but never used
dummy = dummy;
//* Read the output state
if ( (AT91F_PIO_GetInput(AT91C_BASE_PIOB) & LED1 ) == LED1 )
AT91F_PIO_ClearOutput( AT91C_BASE_PIOB, LED1 );
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 work

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


RE: FreeRTOS+lwIP Demo - timer int doesnt work

Posted 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 :]

[ 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