Problem with Mailbox in uCOS

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hello everyone,

We are using uCOS for our application. We need to read data from the
UART. So we have an UART Rx interrupt for this. In the ISR, we are
using a mailbox to post message to the processing task. The processing
task is Pending on the mailbox using OSMboxPend( ) . When we do this
we are loosing some data because of the limited FIFO size. The FIFO
size is 16 bytes and the baud rate for data transmission is 9600.

When we processed the data within the ISR (ie without using mailbox),
we were not loosing any data. But its not a good idea to process the
data inside the ISR.

Could anyone suggest a better way to deal with this problem.

R a n j i t h

Re: Problem with Mailbox in uCOS

Quoted text here. Click to load it

I would suggest that you store received data into software buffer in your
ISR and
notify processing task that there is some data in that buffer...And at the
end of ISR
re-check UART buffer, to see if any character arrived during ISR processing.
nicely on several apps...



Re: Problem with Mailbox in uCOS

Quoted text here. Click to load it

The easiest way is to increase your software buffering between your ISR
and application.  I recommend implementing a FIFO of sufficient size,
then having the ISR insert at the head and the application removes from
the tail.  The ISR signals the application at whatever condition you
1) any character added
2) specific character added, e.g., CR
3) certain number of characters

I have used this in a system with four serial ports and no problems.  In
my case, I defined a general mechanism for the application to specify
the wakeup condition.  The application layer also called a port
initialization that took a buffer address for the FIFO and the size.

For the application side, I would wait for the activation, zero out the
activation semaphore with OSSemAccept(), then process all available
characters before waiting on the semaphore again.


Re: Problem with Mailbox in uCOS
As far as I know, a Mailbox has no FIFO per se. It can handle one pointer
sized object at a time. If a new object is inserted before the previous one
is removed, one will be lost. A Message Queue might be a better choice.
It can handle multiple pointer sized objects. That way occational backups
can be tolerated without loss of data.


Quoted text here. Click to load it

Re: Problem with Mailbox in uCOS
Thanks for your suggestions. Finally i could get the things working. I
had FIFO level interrupt generator which i used to trigger this event.
Things are working fine so far.

Also I was not trying to send any valid data thru the mailbox.


Quoted text here. Click to load it

Site Timeline