Hello FreeRTOS forum!
I am in the process of designing a platform using FreeRTOS, and I am scratching my head about how to best implement the serial communication.
There are going to be as many as five UARTs live, and potentially communicating simultaneously. The baud rates are however not very high, typically 9600 baud, but I would like to have the opportunity to go faster one day. The chip is a HCS12XET256 with cpu clock = 73.7 MHz and 8 KB ram (without paging), and most time will be spend waiting for activity on UART(s).
I would like to have a modular design, such that I can hook my high level drivers to any of the UARTs.
My first thought was to simply implement the lowlevel UART drivers with FreeRTOS message queues. That would mean five transmit queues, and five receive queues that simply transfers the data bytes directly. I would get deferred processing and UART abstraction out of the box with minimum effort.
But then I read in the FreeRTOS book on page 89 that "passing individual characters through a queue is extremely inefficient … and not recommended for production code" and I began thinking about other ways to implement the lowlevel driver.
In any case I need to have a buffer that the receive ISR can dump bytes in. And, in any case, I need to make the ISR let other tasks know that there is fresh data in the buffer. So if I roll my own receive buffer and use a semaphore for signalling (which is a minimal message queue), am I not back to the same amount of overhead as the original message queue idea?
Any comments would be appreciated