richard_damon wrote on Sunday, June 27, 2010:
Not having the details of how you are making an “Interrupt-generated control signal” it is hard to tell what your problem is, and I suspect it really isn’t a problem in FreeRTOS, though it may be in how you are using it.
By design, FreeRTOS needs to disable at least certain interrupts for periods of time to create critical sections, so that it can update some data structures. If this is the cause of your problem, one solution would be to make sure the interrupt you are using in your pulse generation is one that is not disabled, which also means that interrupt can not call any FreeRTOS routines. (Not all ports support this though, it would be nice to know what processor you are using).
If you can not do this, you may need to set up your program so it doesn’t do anything needing longer critical sections (depending on the allowable variation), which will probably require it to be running a task that disables scheduling while you are timing the pulse.
I will note that using interrupts for precise timing control at this level is normally dangerous, and needs to be done only with a careful analysis of the processor and software being used, as there are a number of things that can cause increased interrupt latency. One of the cost of generic multi-tasking, is the need for critical section to protect shared control data, and this causes interrupt latency.