Quality RTOS & Embedded Software

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


Weird characters coming from UART0

Posted by mcufan on May 1, 2013

I am trying to use comtest.c and/or comtest_strings.c on an LPC2138 to send and receive bytes via UART0. I modified the Rx task to accept any string and receiving characters seems to work, at least when I type something in the hyperterminal the LED flashes. However if I check whether the received byte is eg. 'A' then toggle a LED, then it won't light up. It means somehow it received something else than what was sent from my PC.
I think I have the same problem with the Tx task: although I set it to transmit the 'ABC' string it seems to transmit some garbage to my PC's COM port: mostly the following bytes: 0xC3 and 0xBE but sometimes something else. I have 19200 baud rate, 8-N-1 configured on both my PC and in FreeRTOS.
The hardware clearly works, because when I download a demo firmware it nicely transmits strings and can even echo my typed characters back.
What do you think can cause such strange behaviour? I also have a higher priority task running: it periodically resets an external watchdog hardware. But I don't think that would interfere as it runs only ever second.

RE: Weird characters coming from UART0

Posted by Richard Damon on May 2, 2013
My guess is that you have the baud rate set wrong, perhaps because you have the clock rate set wrong. I bet if you look at the serial port for transmit with a scope the bit time is off.

RE: Weird characters coming from UART0

Posted by mcufan on May 2, 2013
Hi richard_damon,

It was indeed the frequency which was set incorrectly. I forgot to change it. I checked the XTAL frequency on the board, multiplied it by 4 (due to PLL) and set this value to configCPU_CLOCK_HZ in FreeRTOSConfig.h. Now it is working like a charm. Thank you very much for your help!

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

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

Latest News

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

Version 10.1.1 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