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

Queue, Semaphore and timing

Posted by Gerhard Kreuzer on October 4, 2011
Hi,
my problem:
I want to transmit some messages, which takes time (USART ...). I post one message after the other using a queue and after the first post I tell the hardware to start transmitting. After the hardware has sent the first message, the next message is taken and so on, in the meantime more messages will be created and put in the queue.
After creating all messages, I know the number, I have to wait for the end of transmission of the last message. Not the end of any message or the beginning of the transmission of the last message or whatever.
So, waiting until the queue runs dry isn't the correct way.
Has anybody some idea to manage this situation in some elegant way with FreeRTOS?

Thanks.

With best regards

Gerhard

RE: Queue, Semaphore and timing

Posted by Richard on October 4, 2011
You would have to implement something in the UART interrupt handler. For example, presumably the UART will continue transmitting for as long as there is data to transmit. When the queue is empty, and the last message received from the queue has been sent completely, the UART interrupt will know, and can set a semaphore to indicate such. The task can then take the semaphore before it starts sending messages to the Tx queue, then block on the semaphore again once it has posted all the messages to the queue. When the task unblocks, it knows the UART Tx interrupt has finished.

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