[En-Nut-Discussion] Nut/OS goes Real-Time?

Matthias Ringwald mringwal at inf.ethz.ch
Fri Jul 1 12:59:41 CEST 2005


Hi

I guess some of you know that whilest Nut/OS is way cool to write  
embedded apps, its real-time performance is
not so good in some circumstances. I'd like to share the (crazy)  
idea, I just got and hope for comments/
improvements and corrections:


Nut/OS goes Real-Time

Problems: The required latency for some specific IRQs cannot be met  
by current Nut/OS although total throughput is not an issue (e.g. SPI  
TX in slave mode at 19200 baud: latency < 10 uS but interrupt only  
every 400 us)

Proposal: reduce IRQs to minimal & fast handling of their respective  
tasks.
e.g. the SPI handler does require a single byte read and write, the  
UART RX IRQ only has to read the received single byte and can store  
it in a global variable.
The remaining processing could then be done by code which has lower  
priority then IRQs but can interrupt app threads. This could an IRQ  
that has a lower priority than the other IRQ priority handler of the  
ATmega. In this fake IRQ handler (which does interrupt application  
threads) IRQs are still enabled to allow the important IRQs to be  
processed.

In addition, CriticalSections have to be very short and/or they  
actually only should block the low priority add-on handler just  
proposed. so if the total load is below the max, everything should  
run nicely. Maybe someone with more RT systems experience/ data  
processing theory could comment on this :).

This scheme looks feasible for UART, SPI and RTC Timer. Additional  
Timer processing (.. every ms for 10 us but with 20 us latency) could  
be added here, if the work is still low.


Cheers,
  Matthias





More information about the En-Nut-Discussion mailing list