Asynchronous serial data with 115200 bit/sec

jonas1978 wrote on Friday, September 04, 2009:

Hi
I know this is not the first time this topic has been discussed, so please forgive me.

I am working with FreeRTOS 5.2.0 on a NEC 78K0R-KG3 (12 kb RAM/ 256 FLASH / ~14 MHz) in preemptive mode with approx. 5 tasks. FreeRTOS is brilliant – easy to work with and stable!

My device interfaces another device using the built-in UART running 115200 bit/sec. Unfortunately I have no flow control available (neither sw./hw.) so I am really struggling to find a solution so I do not lose characters in my Rx interrupt. I believe the enter/exit critical section in for instance vTaskDelay (calls xTaskResumeAll() ) can take longer than the approx. 80 us I have between my incoming characters.

I have two onboard DMA controllers that can help me, but I have a total of 4 UARTS that I may, or may not, want to use in 115200 bit/sec.

Can anyone confirm that there is no easy way to solve this type of problem, other than using either DMA or implementing some kind of flow control.

Best regards,

Jonas, Denmark

petermeier wrote on Friday, September 04, 2009:

Hi Jonas,
try to define the uart interrupt priority higher than all rtos related tasks. So the uart isr can interrupt the scheduler. Within the interrupt write the received character into a receive buffer (FIFO). Back in your task you can access the buffer.
Could be that a solution?

jonas1978 wrote on Friday, September 04, 2009:

Hi Peter
I have prioritized my UART RX interrupt at the highest possible level, but the problem is that interrupts are completely disabled when FreeRTOS execute some operations. No matter how the UART RX interrupt is prioritized it will not be executed…

/Jonas

jonas1978 wrote on Saturday, September 05, 2009:

** Update **
I have implemented a work-around using the two onboard DMA controllers, but I am still wondering if their is another solution.

BR,
Jonas

davedoors wrote on Saturday, September 05, 2009:

I would not call that a work around but the reason why the DMA is provided in the first place and what is expected to be done.