FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [September 2014 Threads] Queue Overwrite with more than 1 itemPosted by celephicus1 on September 22, 2014 Before using FreeRTOS I used a simple ring buffer to hold a trace of information, arranged so that if it filled new items would overwrite the oldest, so I always had the newest information if they were written before they can be read. What is the easiest way of implementing this in FreeRTOS, by checking if the queue is ful and then eleting the oldest item before inserting a new one? Or I could just use a semaphore with my existing ring buffer code.
Queue Overwrite with more than 1 itemPosted by heinbali01 on September 23, 2014 Hi Tom,
For tracing, I would keep on using the ring buffer because it is 'lite'.
Here's another example:
https://sourceforge.net/p/freertos/discussion/382005/thread/74007c10/?limit=25#d9ec
which can easily be used during an ISR.
For 'real-time' tracing, I would prefer to occasionally lose a message rather than protect every trace action with a semaphore.
But if you want to use queues, that is possible of course.
Note that a queue could either store characters (which is 'expensive') or pointers to messages.
And also the caller will have to make sure that there is space by removing an old message if it is full... and action which could also be protected by a semaphore...
Regards,
Hein
Queue Overwrite with more than 1 itemPosted by celephicus1 on September 24, 2014 Thanks for the answer, the post you pointed to provided the answers. I shall use my lightweight ringbuffer implementation, with protection whilst I modify the buffer pointers with a critical section, that will disable interrupts for a few cycles only. FreeRTOS queues are far too heavy a solution for just logging a few events. I don't need to log in interrupts, only in tasks, but the critical sections will prevent a task switch in the middle of modifying the ring buffer pointers.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|