2 Replies Latest reply on Jan 6, 2018 10:59 PM by priyanob

    I2S Auto or Manual

    priyanob

      If I want to use USB audio mono out with CX3, what is the best method among below

       

      a) Auto DMA USB endpoint to I2S Left channel alone, I2S right channel uninitialized.

      b) Manual DMA USB endpoint to CPU and from CPU to I2S Left channel alone, I2S right channel uninitialized.

       

      I have tried (a), with I2S continuous mode as below.

          /* Configure the I2S interface. */

          CyU3PMemSet ((uint8_t *)&i2sCfg, 0, sizeof (i2sCfg));

          i2sCfg.isMono = CyTrue;

          i2sCfg.isLsbFirst = CyFalse;

          i2sCfg.isDma = CyTrue;

          i2sCfg.padMode = CY_U3P_I2S_PAD_MODE_CONTINUOUS;

          i2sCfg.sampleRate = CY_U3P_I2S_SAMPLE_RATE_44_1KHz;

          i2sCfg.sampleWidth = CY_U3P_I2S_WIDTH_16_BIT;

          status = CyU3PI2sSetConfig (&i2sCfg, NULL);

          .

          .

          .

          .

          .

          /* Create a DMA Auto channel between two sockets of the

           * U port and the L and R I2S sockets. DMA size is set

           * based on the USB speed. */

          dmaCfg.size = size;

          dmaCfg.count = 4;

          dmaCfg.prodSckId = SOCKET_ID_CX3_UAC_SPK_PRODUCER;

          dmaCfg.consSckId = CY_U3P_LPP_SOCKET_I2S_LEFT;

          dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;

          dmaCfg.notification = 0;

          dmaCfg.cb = NULL;

          dmaCfg.prodHeader = 0;

          dmaCfg.prodFooter = 0;

          dmaCfg.consHeader = 0;

          dmaCfg.prodAvailCount = 0;

          status = CyU3PDmaChannelCreate (&glCX3_UAC_I2sLeftCh,

                  CY_U3P_DMA_TYPE_AUTO, &dmaCfg);

          if (status != CY_U3P_SUCCESS)

          {

              CyU3PDebugPrint (4, "CyU3PDmaChannelCreate failed, Error code = %d\n", status);

              CyFxAppErrorHandler(status);

          }

       

      When I stream audio from the host (Android/Linux/Windows), I am hearing a tick noise every 1 second. This can be removed by changing the 'i2sCfg.padMode = CY_U3P_I2S_PAD_MODE_CONTINUOUS; ' as 'i2sCfg.padMode =

      CY_U3P_I2S_PAD_MODE_NORMAL; '. But, then there a small background noise along with audio comes.

       

      My descriptors advertise it as 44.1kHZ, 16 bit per sample mono audio device with bInterval=4. Cannot share the project.

       

      1) What can be the source of such periodic 'tick' noise?

      2) What shall be the suggested I2S padMode for I2S setting?

      3) Manual DMA or Auto DMA best method people use for USB audio out applications?

      4) Any reference code for a working prototype of USB audio out?

        • 1. Re: I2S Auto or Manual
          savj

          Hi,

           

          1) What can be the source of such periodic 'tick' noise?

          >> We need to test it in order to understand what exactly is the problem.

          2) What shall be the suggested I2S padMode for I2S setting?

          >> You can also try right and left justified padMode and check. Ideally Normal mode should work fine.

          3) Manual DMA or Auto DMA best method people use for USB audio out applications?

          >> Auto is the best method.

          4) Any reference code for a working prototype of USB audio out?

          >> We do have a reference code in the FX3 SDK. Please check it.

           

          Regards,

          Savan

          • 2. Re: I2S Auto or Manual
            priyanob

            What is the difference between CY_U3P_I2S_PAD_MODE_CONTINUOUS and CY_U3P_I2S_PAD_MODE_NORMAL?

             

            I assume, you have working prototypes for audio out verification before you release SDK. A prototype with speaker, DAC and CX3 would have helped you for the verification of I2S APIs for CX3 SDK.

             

            Do you have such a working prototype for audio out with aforementioned properties? If yes, did you try using Auto DMA mode for USB audio out? Have you experienced any periodic noise?

             

            We use a DAC, TAS2521 from TI to connect speaker to CX3. I am not sure about how you test my code at your place since it depends on my hardware. It would be helpful, if you can share the source code for your prototype. We shall try the same DAC you used in your prototype?

             

            NOTE:- The I2S example along with SDK would not help me.