3 Replies Latest reply on May 27, 2020 3:24 PM by BoTa_264741

    Proper way to DMA to a control register?

    PeWa_3215941

      I'm attempting to learn about the PSoC5LP using the CY8CKIT-059. I'm starting to learn about the DMA peripheral and USB using the USBFS AUDIO PSoC3/5LP Code Example. I made some modifications:

      • Commented out the LCD routines since the CY8CKIT-059 doesn't have an LCD
      • Changed the sampling rate to 48kHz
      • Changed the audio format in the USB descriptor from PCM8 to PCM (since macOS doesn't support PCM8)
      • Added a SW loop to convert all 48 samples after each transfer to the RAM buffer from PCM8 to PCM. I can do this simply by XORing the high bit of each 8-bit sample.

       

      I've tested my changes and they all work fine. I can play music through the PSoC from macOS. Now I'd like to replace my SW loop with a control register which will XOR the high-bit like so:

       

       

      Then, to DMA to the control register instead of the VDAC8, I changed the example code here (line 05):

       

      /* DMA Configuration for VDACoutDMA (Memory to VDAC) */
      #define VDAC_DMA_BYTES_PER_BURST    (1u)
      #define VDAC_DMA_REQUEST_PER_BURST  (1u)
      #define VDAC_DMA_TD_TERMOUT_EN      (VdacDma__TD_TERMOUT_EN)
      #define VDAC_DMA_DST_BASE           (HI16((uint32) Control_Reg_PCM_Control_PTR))
      #define VDAC_DMA_SRC_BASE           (CY_PSOC5LP) ? ((uint32) soundBuffer) : (CYDEV_SRAM_BASE)
      #define VDAC_DMA_ENABLE_PRESERVE_TD (1u)
      

       

      and here (line 05):

       

          for (i = 0u; i < NUM_OF_BUFFERS; i++)
          {
              /* Set source and destination addresses. */
              CyDmaTdSetAddress(VdacOutDmaTd[i], LO16((uint32) &soundBuffer[i * TRANSFER_SIZE]),
                                                 LO16((uint32) Control_Reg_PCM_Control_PTR));
          }
      

       

       

      However, now I get no sound output.

       

      I have a few questions:

       

      1. Is this the proper way to DMA to a control register?
      2. Can I just feed my control register into my VDAC and strobe the VDAC with the 48kHz clock like I'm doing? Do I need to worry about settling time for the control register, etc.?
      3. Bit 7 is the hight bit, right?
      4. How should I go about debugging this? How can I tell that my DMA samples are getting to the control register? How can I tell if the VDAC is getting the samples appropriately?

       

      I've attached my archived (minimal) project.