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




Loading

Interrupt problem on uart

Posted by Nobody/Anonymous on December 6, 2006
I modeled an ISR handler on the serial.c example (for the dual UARTs on
the Atmel AT91SAM7X256).

I have 2 tasks in my system - one which talks on the Ethernet (lwIP), the
other for an RS-232 console user. This, and the several ISRs (timer,
uarts, etc.) The Ethernet task is essentially idle as the cable is
unplugged.

When I write a long message to the console, I need to have a queue at
least as large as the largest screen paint I do (> 2K) in order for it to
work. If I don't, the task waits forever for the queue to clear, but the
queue doesn't clear even though the interrupt is enabled if I use a
non-zero timeout in the xQueueSend call. The application was ported from
a PIC18 (no OS) and I had no trouble putting out messages larger than the
buffer size.

I found the same problem early on with serial.c, not realizing it was
something inherent rather than a mistake in my code.

I'm wondering - is there something I'm missing here? It seems that it
would be a most basic function to allow other tasks (especially
interrupts) to run while another is blocked for a resource. We're not
talking about priority inversion, just having interrupts operate while a
task is blocked.

RE: Interrupt problem on uart

Posted by Richard on December 6, 2006
Some points:

1) The UART examples are not necessarily designed to be efficient - but rather to test the kernel. Testing the kernel implies generating lots of interrupts and context switches which is probably not what you want in your real application if sending 2K or data. You might be better or using a simple circular buffer, then a semaphore to handle the blocking and waking of the task. Also the demos don't make use (normally) of FIFO's or DMA's so you may want to look at the setup of the UART.

2) Can you confirm that you are not blocking from within the IAR, or making any blocking calls from within the ISR - this would definitely stuff you up if you were.

3) You can certainly run other tasks and interrupts while one task is blocked on a queue or semaphore. Is it possible that there is a rout out of your ISR (for example a switch to another task) that is performed leaving the UART interrupt disabled/not cleared? A context switch must not be performed until both the UART and the interrupt controllers are cleared.

Regards.


[ 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