0 Replies Latest reply on Mar 29, 2017 5:29 AM by nuno.antunes_2058241

    I2S DMA interaction for Audio sample measuring

    nuno.antunes_2058241

      I've attached my project for perhaps a bit more ease of communication here. The application of the PROC CYBLE222014-01 chip I am using it for measuring audio samples from a microphone on the chip.

         

      If you take a look, you will see that I am using 2 blocks: an I2S Master, and two DMA blocks. All pins are connected to the appropriate hardware terminals in the .cydwr file.

         

      Now, my trouble lies in processing the data read from the DMAs. I have only one channel mono left configuration and I wish to store the incoming data in two buffers,i2sBuffer and i2sBufferCopy. For each sample i2sBuffer receives the data directly from I2S and transfers in into the second buffer i2SBufferCopy, where all samples (in total 1000) are collected. However, when I debug (I am using the MiniProg3), and view the buffers in my 'Watch' window, the data that comes through is not as expected; the input to my tuner is a function generator producing a sine wave of 1250 Hz, and the data coming through in the end does not seemingly refer to those a sine wave. Is there something missing in my code or should I also configure other parameters? The following specs are probably relevant:

         

      Data bits: 32.
      Word select period: 64

         

      Source Clock 6.144MHz
      Audio sampling frequency: 48 kHz ( = 6.144MHz / 64 / 2)

         

      Bit Resolution: static

         

      Number of Channels: mono left interleaved

         

      DMA Request: enabled
       

         

      Another problem is the order, on which the bytes are copied from the first to the second. As example the first DMA transfers the following sample: 0xFAF7C000  and saves it in i2sBuffer.

         

      Then the copied sample appears in i2sBufferCopy in inverted order: 0x00C0F7FA. Is there a possibility to enable swapping between DMAs? The I2S has "Byte Swap" functionality, but it is disabled in case of considering 32-bit samples.

         

      I am hoping that someone can help me identify what mistakes I am making in my configuration functions;

         

      Thank you in advance for the invested time. Hope to hear from you soon!

         

      Nuno Alves