2013-06-27 04:04 AM
2013-07-09 08:38 AM
Hi,
I found a bug in the code that I posted above.InDMA1_Stream3_IRQHandler,
the lineif (DMA_GetITStatus(DMA1_Stream3, DMA_FLAG_TCIF3) == RESET)
should beif (DMA_GetITStatus(DMA1_Stream3, DMA_IT_TCIF3) != RESET)
to actually check for the correct interrupt status.It seems a common mistake to mix the usage ofDMA_FLAG_TCIF3
andDMA_IT_TCIF3.
However, this doesn't solve the problem, that the buffer is not switchedautomatically. Any ideas?Kind regards,Roland2013-08-08 02:58 PM
I'm configuring DMA almost identically and I'm having a similar issue. The documentation is really unclear. As far as I can tell, you're supposed to get a transfer complete interrupt when NDTR (BUFFERSIZE in your example) has reached 0. Now I would assume that the sequence would be:
1) Start DMA2) NDTR reaches 03) CT=1, DMA writes to M1AR (done in HW)4) NDTR reloaded to BUFFERSIZE5) TCIF set (and you get the interrupt)6) Now you can mess with buf[0]7) NDTR reaches 08) CT=0, DMA writing to M0AR9) NDTR reloaded to BUFFERSIZE and you get TCIF interrupt10) Mess with buf[1]However, this isn't the behavior I see. I suspect there's probably a half-transfer complete interrupt that we should be using.BTW, printf inside an ISR is generally a bad idea. You might want to consider toggling a GPIO and using a scope.2014-10-20 05:58 AM
Hi Andrew,
thank's for your reply, ... already some time ago.The project hibernating for some time and I didn't check the forum since then.But now I'm coming back to this topic. And I'm wondering, if you or anyone else has found a solution to the double buffered DMA transfer...If so, please let me know.Cheers, Roland2014-10-20 09:43 AM
Yeah, I really don't want to wade into this too deeply, but you should probably confirm if any SPI activity is occurring. To Rx there usually needs to be some Tx activity to generate clocking.
2014-10-20 01:05 PM
> To Rx there usually needs to be some Tx activity to generate clocking.
Clive: Isn't this the odd case of receive-only setup? Roland: As was said above, get rid of the printf(). Find some other way to indicate the even/odd buffer: toggle a pin and observe it with an oscilloscope. JW2014-10-20 04:35 PM
Clive: Isn't this the odd case of receive-only setup?
I don't have enough mileage around this edge of the design to really know, one might hope, but if the DMA isn't completing I'd want to be sure any of the DMA/Transfer is occurring.