AnsweredAssumed Answered

SPI DMA, with fixed timing for DAC

Question asked by Mathias Koch on Jun 15, 2015
Latest reply on Jun 18, 2015 by Earl Orlando Ramirez Sanchez

Hi guys

 

I am currently trying to work out how to get the SPI on my k20 to work with TX only DMA for a DAC

 

The thing is, i have a buffer containing a signal sampled at some frequency, fs, and i need to recreate this signal using my SPI dac, DAC7811 from TI.

 

It is a 12 bit dac with 4 control bits, eg i need to do DMA transfers of 16 bits.

 

But i need to write these 16 bits to the DAC at the same frequency as it is sampled? How can i do this? Until now i have been trying to use a PIT with a periodic trigger of FS and then use an always enabled source for the DMA. It seems to work, but i can quite work out how if i really have to start the SPI module every time in my DMA interrupt? Eg.

 

SPI0_MCR &= ~SPI_MCR_HALT;

while(!(SPI0_SR & SPI_SR_EOQF));

SPI0_SR |= SPI_SR_EOQF | SPI_SR_TCF ;

SPI0_MCR |= SPI_MCR_HALT;

 

The perfect end result would be a circular DMA read from my buffer (using SMOD?), that i can start once, it would transfer the entire buffer through DMA (at specified FS) and it would stop itself at the end of the buffer and reload, ready  to be started again.

 

I really hope you can help me.

 

Best regards

Mathias.

Outcomes