i.MX8M Mini - Can spidev use DMA?

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

i.MX8M Mini - Can spidev use DMA?

1,638 Views
surrealist14
Contributor III

Hi NXP community,

We are using an i.MX8M Mini to communicate with a TI ADS1299 EEG Analog Front end.  The data acquisition rate of the ADS1299 can be programmed, and we typically run it at 8K samples/second.  This will cause a new batch of data to be available every 125 usec.

I have Linux configured to create /dev/spidev0.0, which uses a GPIO for the chip select.  I have the DRDY# interrupt from the ADS1299 connected to another GPIO input, and I am using libgpiod to detect and respond to interrupts.  However, it appears that we sometimes miss interrupts and therefore miss data.  My criteria for this is that the time between the previous interrupt and the latest interrupt is >250 usec, since we should receive an interrupt every 125 usec.

When an interrupt occurs, I have to read 27 bytes of data from the ADS1299, which includes 3 status bytes, plus 3 * 8 channels * 3 bytes/channel of ADC data.

Can spidev be configured to use DMA for this data transfer?  It's unclear to me how the /dev/spidev0.0 driver connects to the underlying spi-imx driver.  On Linux Warrior, I did not see any ioctl() calls available for spidev that would allow me to control DMA.  I am not sure if this has changed for Linux Zeus.

Thanks for your advice.  I have been trying to do this from user space since I am not familiar with writing kernel mode drivers, and don't even know if a kernel mode driver would help prevent missing interrupts.

Best regards,

Scott

0 Kudos
4 Replies

1,066 Views
nkumar3119
Contributor I

Hi surrealist14,

Were you able to get spi working with dma? Would be able to share code example? I am using MX8M-mini trying to communicate to TI ADS131M08 via SPI.

 

Thanks!

0 Kudos

1,566 Views
igorpadykov
NXP Employee
NXP Employee

Hi Scott

one can look at ecspi2 "dmas" entries in attached dts files 

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

0 Kudos

1,565 Views
surrealist14
Contributor III

Thank you for the example, Igor,

However, this still does not indicate whether spidev is actually going to use DMA or not.  How can I tell if spidev is using DMA for SPI transfers, rather than programmed I/O transfers? 

There does not appear to be any ioctl() or other call available from spidev to set up a DMA transfer vs. any other type of transfer, so how can I prove that transfers are taking place using DMA?

Best regards,

Scott

0 Kudos

1,566 Views
igorpadykov
NXP Employee
NXP Employee

Hi Scott

 

dts "dmas" entries ensure that ecspi2 driver uses dma, irrelevant

with spidev or not. Spidev does not use ioctl() DMAs, it is done in ecspi driver.

 

Best regards
igor

0 Kudos