2 Replies Latest reply on Sep 16, 2015 3:47 AM by hima

    SPI (master) doesn't transmit DMA data

    binka.puss

      Good afternoon all!

         

      I'm new to these forums, so hopefully this is the right place to ask for some guidance from the pSoC experts :)

         

      I'm attempting to use the DMA engine to transfer data from the digital filter block to an external DAC using the SPI (configured as master mode).  I've connected the DFB's DMA_Req_B output to the DMA drq input and verified that the DMA does transfer the desired data correctly if I target an SRAM memory location.

         

      If I attempt to direct data to the SPI FIFO however, the interface remains quiet and the status bits reflect the FIFO is empty at all times (just as though the data isn't making it to the FIFO at all).  The following code snippet shows my configuration:

         
           // Filtered values -> DAC (via SPI)   
         
           DMA_DAC_Chan = DMA_DAC_DmaInitialize(2, 1, HI16(CYDEV_PERIPH_BASE), HI16(CYDEV_PERIPH_BASE));   
         
           DMA_DAC_TD = CyDmaTdAllocate();   
         
           CyDmaTdSetConfiguration(DMA_DAC_TD, 2, DMA_DAC_TD, DMA_DAC__TD_TERMOUT_EN);   
         
           CyDmaTdSetAddress(DMA_DAC_TD, LO16((uint32)OUTPUT_FILTER_HOLDBM_PTR), LO16((uint32)SPI_TXDATA_PTR));   
         
           CyDmaChSetInitialTd(DMA_DAC_Chan, DMA_DAC_TD);   
         
           CyDmaChEnable(DMA_DAC_Chan, 1);   
         
              
         

      The DMA's nrq output toggles after every instant I'd *expect* a transfer to have occurred, but still no SPI data appears.  I've tried many permutations of SPI buffer address, pointer etc, but haven't found a combination that works.  DMA writing to a global variable in SRAM is OK, though.

         

      The SPI interface seems to be correctly configured - manually dropping a word into the buffer via:

         

      SPI_WriteTxData(value);

         

      works OK.

         

      Does anyone have any idea what I'm missing?  It's driving me crackers!

         

      Cheers :)