Controlling ECSPI from Linux userspace

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Controlling ECSPI from Linux userspace

1,600 Views
surrealist14
Contributor III

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

0 Kudos
1 Reply

1,525 Views
igorpadykov
NXP Employee
NXP Employee

Hi Scott

I am afraid it is not possible to handle an interrupt from userspace,

for spidev usage one can look at

DART-MX8M SPI - Variscite Wiki 

Accessing SPI Devices in Linux 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos