Quality RTOS & Embedded Software

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


SAM7X debug unit TX/RX

Posted by madis on April 1, 2008

In the SAM7X controller there is one UART available under debug unit. But it shares the same interrupt as periodic timer which is used for FreeRTOS scheduler.

In case I would like to use interrupt driven communication via that debug unit (utilise it as normal uart in my project), I have to modify portISR.c to check if its communication interrupt or scheduler tick.

Has anybody done it? Maybe it would be good idea to add some kind of #define to the FreeRTOSConfig.h for SAM7X to specify whether to use debug unit uart or not? Any other ideas?

BR, Madis

RE: SAM7X debug unit TX/RX

Posted by saiberion on April 1, 2008
You're on the right path. In portISR you have to check from which peripheral the interrupt is coming and handle it.

Here is how I do it:

else if ((((AT91PS_USART)AT91C_BASE_DBGU)->US_CSR & AT91C_US_RXRDY) > 0)

vUsartDebugISR() is an inline function (like vTaskIncrementTick()) that does only puts received data on a queue.
I don't know if it's still the case but when I tried it the first time with a normal function call it didn't work.

I'm not sure where I found this handling. Either in some previous version of FreeRTOS or somewhere here in the forum.

But it is also possible to change the tick timer from PIT to one of the TCs and handle the system interrupt as every other interrupt but I haven't tried that yet.

RE: SAM7X debug unit TX/RX

Posted by Patrick DEFLANDRE on April 2, 2008
Hello madis and saiberion

I use too the DBGU unit for debugging purpose on a serial com. I use it to send messages on a com to show various errors in the processing flow.

I use the Saiberion method which share the PIT interrupt for the kernel tick and the DBGU interface. It doesn't seem to make difficulties on the com processing, but I don't use it for an application communication interface.

By the way, this com has limitation and you will be stuck to an 8 bytes with parity format. The baud rate generator is also more simple, and there is no more rs485, irda, iso7816 mode.

As for the FreeRTOSconfig.h, this DBGU is quite specific for atsam7x. Is it a good idea to insert quite a specific purpose on a more general project like FreeRTOS ? Perhaps a good application example should be enough.

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

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

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

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

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