Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


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 ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.0 is available for immediate download. MIT licensed, and including RISC-V and ARMv8-M (Cortex-M33) demos.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers





STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner