I am working on a customized/proprietary RTOS provided by my client.
The RTOS uses round robin scheduling with priority preemption.
Scenario is -
- The Renesas H8S controller is running at 20 MHz
- I have configured interrupt for ethernet interrupt (A LAN9221 chip is interrupting)
- An OS task which reads the data from LAN controller is running at highest priority in OS
- Another OS task TCP which is second highest priority task in system
- An OS task which referesh watchdog
I have generated network traffic to simulate bombarding condition on the network. Problem is at high data rates (more than 500 packets/second) on ethernet ISR watchdog is getting fired which is configured for 1 second.
Watchdog is configured to be serviced by a lower priority task of OS to detect any problem in OS functionality.
I doubt the frequency of ISR and higher priority tasks are not letting the watchdog task to be scheduled. To confirm my doubt i have serviced the watchdog in ISR itself and found working till 2000 packets/second.
Could you please suggest how can handle the situation so the watchdog should not fire even on higher data/interrupt rate.
Watchdog is refreshed in OS task running at normal OS priority which helps in catching endless loop.
The task which is at highest OS priority is Ethernet packet reading task. There is one hardware interrupt which is raised when Ethernet receives packet and in ISR we schedule waiting Ethernet packet reading task.
Also in my system the OS is not running using timer interrupt (Like other OS run). The OS is round robin and relinquish the control voluntarily. So increasing the watchdog task priority above the normal is not possible otherwise OS will always find it at higher priority and ready (watchdog is refreshed in infinite loop no waiting for any event) and other tasks will not get time to execute. Only tasks which are waiting on some event can have high priorities.
So the problem is watchdog task is not getting time to refresh because of frequent interrupts and continuous scheduling of high priority tasks (Ethernet packet reading).
A task which reads the data from LAN controller is running at highest priority in OS.
How long does this task take to complete? I do believe that the watchdog is not getting enough time to time-out. Try setting it to highest priority and see what happens. My guess is your problem will go away. Since the watchdog should only run very briefly it might not affect your scheduling. – RedX