iMX7 performance mode + SPI

Is there a possiblity to maximize the performance of my iMX7 like on the TK1 (governor, frequency etc)? This would include disabling all kinds of power-saving/ sleeping mechanisms.

Maybe some background information is helpful: I implemented a thread which polls for CAN messages. There is one package per second. The package handling takes about 4ms. The problem is that sometimes the handling is delayed by 10ms and i cannot see a reason for that. Maybe there is a sleep mode active or some other process consumes time. My process thread was set to highest priority. The same issue can be observed with RT patch.

The package handling includes five consecutive SPI transfers. When looking at the signals i can see a long delay between two SPI transfers every once in a while. The pictures are showing: CAN_RX = green, PROCESS_CAN = yellow, SCLK = orange.

If you need a real time performance I’d recommend to use an embedded m4 core of iMX7.
You can use a FreeRTOS or bare mental code.

“Soft” realtime would be sufficient for my application. I am just wondering what kicks in every once in a while and interrupts my SPI/I2C transfers.

By default “CONFIG_HZ=100” it means that if some other thread running now on same core is not going to sleep it will be preempted in 10ms even if it has lower priority than yours.
You can change CONFIG_HZ to 1000 and recompile a kernel. This way you can decrease delay to 1ms. But it will increase context switching overhead.