Imx6/linux: Large and inconsistent latency when issuing an irq triggered spi read

Hi @rdonio

We don’t have any sources for this particular ADC, I am sorry. This is a snippet from @gardarh, maybe he can help you out.

The devicetree files of our hardware can be found in our Git repository of the Linux kernel.

Best regards
Diego

Hi @rdonio,

Unfortunately it’s been a while since I worked on this and I am no longer working for the same company so my memory is a bit hazy on the details and don’t have access to the code. As I remember it I ended up not writing a kernel driver for the ads1198 but just issued direct spi commands from userspace (using ioctl).

That said, I strongly advice against that method since it doesn’t give you any real time guarantees and you may miss samples from the ads1198 (even if it is configured to hold samples for 4ms).

If I were to do this today I would either use a chip with an integrated low level module (e.g. the imx7 has a secondary ARM Cortex M4) or use some external chip acting as a buffer between the ads1198 and your main processor.

In either case the code posted above would be of no use.

Hope this helps!

Hi @gardarh
Appreciate your time.
The confusion is that in your post there are device tree code that imply a driver exist.

Perhaps late to the party here, but I am playing with SPI as a slave (and so have very time critical code). We are experimenting with kernel parameter “isolcpus” to reserve a core (along with nohz and nohz_full). We then use pthread_attr_setaffinity to launch our user space SPI collection thread on the unschedulable CPU.

And what are results of this experiment? Did you see any improvement in SPI latency ?