3 Replies Latest reply on Oct 16, 2020 6:01 PM by muma_3294506

    Averaging/Downsampling ADC-conversions AND transferring them via DMA at the same time


      Dear Community,


      I am fairly new to psoc5lp and have a "CY8CKIT-059 PSoC® 5LP Prototyping Kit" , trying to achieve the following task with it:


      # sample both SAR ADCs simultaniously with sample rate of 768kHz (using external CLK of 24.576MHz)

      # transfer ADC-conversion results via SPDIF transceiver component at sample rates of 48kHz or 96kHz (maybe 192kHz, if possible)


      What I do know:

      # SAR ADC has some limitations, depending on bit-depth, external/internal reference voltage. Lets settle for 10 bit and external reference (proper decoupling assumed).

      # It is possible to transfer conversion results directly to SPDIF component via DMA, which saves a lot of MCU ressources

      # It might also be possible to use a Digital Filter Block as well, i.e.: ADC -> DMA -> DFB -> DMA -> SPDIF . That would be benifitial for noise reduction/low pass filtering

      # DFB can be programmed via assembler instructions


      What I do not know and want to figure out with your help:

      # depending on the output sample rate the ADC results have to be downsampled by a factor of 4, 8 or 16. In order to get the best possible SNR I would like to implement avereraging in combination with downsampling (otherwise I could set the ADC to exact same sample rate as the SPDIF ouput stream)

      # I guess, it should be possible with a custom DSP-program, but I have absolutely zero assembler-skills

      # I can imagine that a simple moving averaging algorithm could be implemented in software, using a end-of-conversion interrupt. BUT: (a) that would cause a lot of CPU load at 768kHz and (b) I am not sure how to attach this software data-handling process to the DMA


      Since the MCU does not have anything else to do, a pure software solution (means: without DMA) is probably feasable, but I have concerns about the high CPU load.


      Do you have any ideas concerning downsampling/averaging and DMA? How would you approach this?