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 Plus IO, LPC1769 UART IRQ Handler

Posted by Joshua Napoli on September 14, 2012
I am setting up FreeRTOS+IO for a LPC1765 MCU. I was working from the LPC1769_FreeRTOS_Plus_Featured_Demo package, where the FreeRTOS_IO.h has version 1.0.0.

The problem I'm running into is that the UART IRQ handler is only implemented for UART3. Is there a more complete FreeRTOS+IO package that I should use? Or should I just implement the IRQ handlers for the UARTs that I need?


RE: FreeRTOS Plus IO, LPC1769 UART IRQ Handler

Posted by Richard on September 14, 2012
Please just create the other UART from the existing UART3. The idea is to keep board support packages that are specific to hardware, and that particular hardware has access to UART3 only.

I have discovered a very small patch to the kernel is required in that version. vTaskPriorityInherit() in FreeRTOS/Source/tasks.c needs a minor modification as follows:

void vTaskPriorityInherit( xTaskHandle * const pxMutexHolder )
tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;

/* If the mutex was given back by an interrupt while the queue was
locked then the mutex holder might now be NULL. */
if( pxMutexHolder != NULL ) //<<<{
if( pxTCB->uxPriority < pxCurrentTCB->uxPriority )
/* Adjust the mutex holder state to account for its new priority. */
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) pxCurrentTCB->uxPriority );

/* If the task being modified is in the ready state it will need to
be moved in to a new list. */
if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ) != pdFALSE )
vListRemove( &( pxTCB->xGenericListItem ) );

/* Inherit the priority before being moved into the new list. */
pxTCB->uxPriority = pxCurrentTCB->uxPriority;
prvAddTaskToReadyQueue( pxTCB );
/* Just inherit the priority. */
pxTCB->uxPriority = pxCurrentTCB->uxPriority;

traceTASK_PRIORITY_INHERIT( pxTCB, pxCurrentTCB->uxPriority );

Apologies for this, it is a recent find and not documented yet. I need to put an errata up until the code is changed. (the change is required because a mutex is used where really a binary semaphore (without priority inheritance) should have been used instead.

There are some improvements and enhancements to the user model in the pipeline for the IO code that will introduce some short-cuts to remove the need for the ioctl calls when using the zero copy mode. Watch this space!


[ 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