cancel
Showing results for 
Search instead for 
Did you mean: 

About SPI and dma from Linux user space

Eldam
Senior

Hello ST People !

I'm looking for information / possiblity to use SPI (via spidev & ioctl) in Linux user space with DMA.

We have to transfert lots of data (4000bytes at one time, very very often) to a fpga, very quickly and we are facing latency issue during transfert.

With the help of a scope, we see dead times between spi transactions during this big packet write.

So we are thinking using spi dma to unload cpu, but we need some infos/direction to look for.

Maybe someone help or points me to right direction?

Bon weekend!

1 ACCEPTED SOLUTION

Accepted Solutions
Eldam
Senior

Well, after a little struggling

With the help of:

https://wiki.st.com/stm32mpu/wiki/SPI_overview

We added kernel debug info and we happy to see:

"dma enabled" in the log file.

so with some modification of calling function (ioctl) we've been able to have a 12Mhz SPI working @ 12Mbits /s

Next phase, modify the clk!

Seeya!

View solution in original post

3 REPLIES 3
Eldam
Senior

After looking at:

https://github.com/torvalds/linux/blob/master/drivers/spi/spi-stm32.c

If I "lsmod" on my board, I see that "spi_stm32" is in the lsmod list.

So If I understand correctly,

If I made call to ioctl (with /dev/spidev0.0 as parameter)

the ioctl function will use the "spi_stm32" driver mod? Thats it?

How do we know if we already or not using dma?

(we have dts enabled dma for spi tree)

Eldam
Senior

Well, after a little struggling

With the help of:

https://wiki.st.com/stm32mpu/wiki/SPI_overview

We added kernel debug info and we happy to see:

"dma enabled" in the log file.

so with some modification of calling function (ioctl) we've been able to have a 12Mhz SPI working @ 12Mbits /s

Next phase, modify the clk!

Seeya!

Hello @Eldam,

Can you please give more details how did you enable the DMA from the driver and enable the debuggug log.
What did you need to change in the kernel driver to make sure that spi is using the DMA?

Thanks in advance!

Kind regards,

Khaled