Interrupt Scheduling in .Net Micro Framework

.NET MF doesn’t support preemptive interrupts. Once a process is completed or the 20 msec timer assigned by the scheduler times out, the interrupts can be processed.

Is there any way to change this 20 msec to a shorter time, or change the scheduler process and make it like a real-time scheduler?

Alternatively, assuming the 20 msec delay can be tolerated to begin the interrupt processing, but the exact time of interrupt occurrence at is a must-to-know factor, I think with time argument in an InterruptPort event handler, one can work backwards and determine the time at which the interrupt got queued.

However, how about if serial port is used, and the time of data arrival to the port must be known? Is there any way that we can determine at what time data arrived to the serial port, or its corresponding interrupt was queued by the framework? Thanks.

That would require some serious rework on a very low level in the porting kit. The good thing is that the code is available along with a 20 or so ports for various MCU/Boards. I would start looking at the Porting Kit code.

Thanks Architect. As you mentioned, changing the code in that level seems to be hard enough to take some considerable time and work.

Do you think is it some how possible to find out at what time data arrived to a serial port port or at least determine what was the time gap from the time it was queued by scheduler to the time it was triggered at the application layer?

I think for an interrupt port the “time” argument could be used for this purpose.

private static void switchPort_OnInterrupt(uint port, uint data, DateTime time)
{
}

But, how about a serial port?

I am not sure but I think this will still require some code changes in the PK. You will need to extend/add the internal data structures to store the time stamp and then propagate it up to the managed side somehow.

1 Like