AnsweredAssumed Answered

Controlling ECSPI from Linux userspace

Question asked by Scott Whitney on Jun 22, 2020
Latest reply on Jun 22, 2020 by igorpadykov

Hi NXP community,

I have an i.MX8M Mini running Yocto Warrior Linux.  I need to connect one of the ECSPI modules (ECSPI1) to an analog front end that will produce new data at a rate of 8kHz.  When new data is available, the analog front end will produce an active low interrupt signal, and I'll need to read the newly acquired data.

 

I'm new to both the i.MX8M Mini and to Yocto, but have a little Linux experience.  I know that it's possible to access SPI devices from userspace using the spidev sysfs interface.  However, I am not sure how to handle an interrupt from userspace in conjunction with spidev.

 

Can anyone describe how the device tree in Linux should be configured for spidev, and how I can enable a GPIO line for a falling-edge interrupt that is handle by userspace code so that the data may be read from spidev?

 

I freely admit to being a newbie, and apologize if I'm not being clear, so feel free to ask follow-up questions if I can clarify.

 

As an aside, I know the ECSPI modules are capable of DMA, which could read out the data with little processor overhead, but have no idea how to set this up from userspace or in the device tree.  Is the use of DMA feasible in this application?  Is any of this feasible from userspace, or is a kernel driver going to be needed.  I've asked, and unfortunately there is no Linux device driver for this analog front end, so we're forced to come up with something ourselves.

 

Many thanks for your time and help!

 

Scott

Outcomes