Fast periodic task on Microblaze

waszil wrote on Wednesday, November 20, 2013:

I am currently experimenting with FreeRTOS on a Microblaze processor. I need to run a physical model with strict timing at high, minimum 1kHz frequency. Besides, i have to handle a field-bus communication with mixed-timing: sending with multiple fix frequencies and asynchronous/cyclic receiving (cyclic freqs less then 100 Hz).
If i try to create a task for the physical model computation with vTaskDelayUntil(), then i suppose it is not the best, because the OS’s tick is 1kHz also, max. I tried to increase the tick frequency, but it did not work properly (the timer interrupt is ok, but the OS cannot do the task’s delay properly).
My question is: what should be the correct way to organize the tasks in this situation? Should i use a specific HW timer for the fast model-computing task?
Thank you in advance for any help!

davedoors wrote on Wednesday, November 20, 2013:

Normally going over 1KHz tick is not a good idea, but it should work at higher frequencies. portTICK_RATE_MS cannot be used when the tick is over 1KHz though. Maybe that was your problem.

As you are using an FPGA is it possible to move your high frequency calculation into hardware? If it has to be software then another option might be to have two soft cores so one can do the high frequency parts.

If neither of those are an option then using a timer interrupt could be best as long as executing the calculations do not take so long as to mess up the field bus. Personally I would not try doing something so fast in a task.

waszil wrote on Thursday, November 21, 2013:

I did not use portTICK_RATE_MS, but maybe I did something else wrong. Anyway, it is already a multi-core system, but yes, it would be the best to translate the fast model to hardware. I was just playing around with FreeRTOS, whether it could be used for this problem or not. I think, for now I stick with some basic timer-driven infinite-loop implementation. Anyways, thanks for the reply!