Page 1 of 1

SPI over DMA example?

Posted: Wed Jan 16, 2013 3:52 am
by Rick Burnett
Hello!

So I've looked through the testhal and example code and maybe I just missed it but I am not seeing an example of how to send data with DMA over SPI. In the STORM example it looks like it's just doing a mem to mem copy.

What doesn't make sense to me is do I need 2 buffers? I see in the init code for SPI that it is in fact setting up the DMA stream associated with SPI2 as I would expect, I am just not sure how to send the data. My code I wrote doesn't do anything and I suspect it's because the destination is not setup right. With the DMA copy, do you still use 2 buffers (source and destination).

Any help appreciated!

Thanks!
Rick

Re: SPI over DMA example?

Posted: Wed Jan 16, 2013 7:48 am
by Rick Burnett
Turns out, you do this already so there is nothing I needed to do but send a bigger chunk with spiSend instead of sending one byte at a time. Works fantastic!

Re: SPI over DMA example?

Posted: Wed Jan 16, 2013 8:43 am
by Giovanni
Exactly, the DMA is used transparently into the various drivers where applicable.

Giovanni

Re: SPI over DMA example?

Posted: Wed Jan 16, 2013 5:09 pm
by Rick Burnett
Excellent work. I really didn't understand that at first. I guess the only thing I will really need to use the DMA transfer functions you've created is on my second project where I want to hang an LCD of the SMC and I can setup the DMA to write to it that way.