mineiro wrote on Wednesday, January 30, 2019:
Hello,
I’m new to FreeRTOS and I’m not sure which architectural approach with FreeRTOS I should use. My task is the following:
I’m using an Infineon XMC4100 Cortex M4 with 80 MHz.
I’m having a fast interrupt with 100 kHz triggered from a PWM.
I would like to scale data and calculate 2 current controllers with 100 kHz.
I would like to calculate some other controllers with 5 kHz.
And I’m having slower communication tasks running in the backround.
I tried do defer the 100kHz interrupt in a task using TaskNotifier. I measured the delay that causes the defering with digital IOs and a scope. It’s 4.5µs without any calculations which is too much if you have only 10µs in total.
So the question is how to do this better?
I could calculate the data scaling and current controllers directly in the interrupt, but that would need quite some calculation time and it is always recommended in the FreeRTOS docu to keep the interrupt short. So what would be the disadvantage of spending let’s say 50% of the time in an interrupt blocking the task scheduler?
And what would be the best way to trigger a 5 kHz task?
Or should I resign using FreeRTOS, but then the communication tasks would be more difficult to program.
If I’m not having enough calculation time at all I could run the controllers with 50KHz instead of 100 kHz, but the problem is still similar.
Any hints?
Greetings, Tobias