0
votes

Can anyone help me do a task with high(like 6kHz) execution rate? Need to do a SPI transmission on this frequency(the task code is already written). I can achieve over 7kHz without any control(just one task with no timing control, running full time), so the time is not a problem.

The problem is that the TICK_RATE has a resolution of ms, which is too high for what I need. Doing some research I found that reducing the time resolution will cause an unwanted overhead.

So, the way would be using an ISR. Is that right? Couldn't find an example of how do that. I have almost null experience in FreeRTos.

Using Toradex FreeRTOS version in Toradex IMX7D.

Thanks in advance.

3

3 Answers

0
votes

Are you asking how to do this using FreeRTOS? in which case the FreeRTOS book has examples, as does the website (this is just one way of doing it). However, as you point out yourself, due to the frequency you really need to be doing this in an interrupt - in which case you need to review the hardware manual to see what facilities the hardware has in regards to DMA'ing data to peripherals, etc.

0
votes

You need to express your task more clear. What MCU? Two side transmittion? Do you have DMA?

You can try to use timer of your MCU to perform timing and in it's ISR run xSemaphoreGiveFromISR.

In RTOS task put listener xSemaphoreTake( xSemaphore, LONG_TIME ) == pdTRUE

0
votes

Resolved it based on the solution in examples/imx7_colibri_m4/driver_examples/gpt(Toradex FreeRTOS version).

Just used GPTB derived from ccmRootmuxGptOsc24m clock. This is important because linux kernel was hanging on startup using the default Pfd0 clock.

To get the frequency I needed just divided GPTB frequency by the desired frequency and passed to GPT_SetOutputCompareValue().