SPI DMA

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Processor is a SAMG55

I've successfully implemented a SPI Master DMA routine, and am now trying to make it a bit more versatile.  As currently written, a buffer must be supplied for both TX and RX as well as a length for the transfer (I set TX length = RX length).  What I would like to do is implement the transfer so that it can be used with a single buffer for either TX or RX.  

 

Only transmitting seems pretty straightforward - simply don't enable the RX channel and set the buffer to NULL, but I'm not sure how to handle only receiving.  It's my understanding that the TX channel will need to send data in order for anything to come back on the RX channel, because SPI. 

 

Is it possible to configure the DMA controller to use a dummy byte that is sent over and over by TX rather than having to create an empty buffer the same size as the RX buffer and iterate through it?

 

Finally, what is the circular buffer mode used for, and how exactly is it used?  The data sheet is very sparse on any information related to that.  Is this the secret to transmitting a dummy byte for a receive only operation?

 

 

Last Edited: Tue. Apr 30, 2019 - 10:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I assume the TX channel in the receive only case can send from a 1 byte dummy buffer (the source address is not incremented). Or it could send (whatever) from the RX buffer since it is not really important what is sent.

/Lars

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What I'm currently doing is just using the same buffer for each, as it works fine in the case of RX only (Incoming bytes overwrite whatever is sent).  Sending from a 1 byte dummy buffer is what I want to be able to do, but there's no documentation showing if/how this can be done.