SPI over DMA example?

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
Rick Burnett
Posts: 150
Joined: Tue Jan 08, 2013 2:20 pm

SPI over DMA example?

Post 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
Rick Burnett
Posts: 150
Joined: Tue Jan 08, 2013 2:20 pm

Re: SPI over DMA example?

Post 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!
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: SPI over DMA example?

Post by Giovanni »

Exactly, the DMA is used transparently into the various drivers where applicable.

Giovanni
Rick Burnett
Posts: 150
Joined: Tue Jan 08, 2013 2:20 pm

Re: SPI over DMA example?

Post 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.
Post Reply