AnsweredAssumed Answered

ADuCM350 SPI DMA in pingpong mode

Question asked by amf on Jan 5, 2016
Latest reply on Jan 18, 2016 by amf

(To the moderator:  I posted this on 1/3/16 at the end of the thread for the SpiMasterSlaveTest discussion, but perhaps I should've posted it as a new question.  Were you able to "see" that I had posted that latest question?)



  I am trying to understand the DMA usage in two examples:  AmperometricMeasurement and SpiMasterSlaveTest (because I want to merge some SPIH DMA code into AmperometricMeasurement.c.  The AmperometricMeasurement.c code sends 900 sps data out the UART, but I'd like to send 160 ksps data out the SPIH port, where the SPIH port is set up as an SPI slave and Labview is an SPI master).  I have a couple of questions regarding "ping-pong buffering".  I wrote my questions out in more detail in the attached screenshots, but briefly:


1)  There is a function, dmaInit() in afe.c and there is another dmaInit() in spi.c.  Will the compiler keeps these straight if both are used in the same project?  (I guess so).


2)  The AmperometricMeasurement example switches between two buffers where the AFE DMA writes to one buffer while the UART grabs data from the other, and then in the DMA-finished interrupt handler, the buffers are switched.  I noticed that the DMA mode is set to BASIC in this example.  On the other hand, I noticed in the SpiSlave project of the SpiMasterSlave workspace example, that the DMA mode seems to be set as PINGPONG, but I don't know if it's really ping-ponging.  Is it?  Also, it looks like the DMA-finished interrupts are enabled, yet it uses polling and there doesn't seem to be any interrupt handler routines.  Can you explain what's actually happening, as far as the DMA, in the SpiSlave project?