1 Reply Latest reply on Jan 19, 2017 2:24 AM by madhul_36

    I2S Register mode



      I tried to use I2S with register mode. The function CyU3PI2sSetConfig is failing with a status error code of 0x40 which is CY_U3P_ERROR_BAD_ARGUMENT. Doesn't the CX3 I2S support register mode or am I missing anything in the configuration?


      Following is the portion of code used for configuring I2S in register mode.




          CyU3PI2sConfig_t i2sCfg;
          CyU3PDmaChannelConfig_t dmaCfg;


          /* First initialize the I2S interface. */
          status = CyU3PI2sInit ();
          if (status != CY_U3P_SUCCESS)
              CyU3PDebugPrint (4, "CyU3PI2sInit failed, Error code = %d\n", status);
              CyFxAppErrorHandler (status);


          /* Configure the I2S interface. */
          CyU3PMemSet ((uint8_t *)&i2sCfg, 0, sizeof (i2sCfg));
          i2sCfg.isMono = CyFalse;
          i2sCfg.isLsbFirst = CyFalse;
          i2sCfg.isDma = CyFalse; //Register Mode
          i2sCfg.padMode = CY_U3P_I2S_PAD_MODE_NORMAL;
          i2sCfg.sampleRate = CY_U3P_I2S_SAMPLE_RATE_44_1KHz;
          i2sCfg.sampleWidth = CY_U3P_I2S_WIDTH_16_BIT;
          status = CyU3PI2sSetConfig (&i2sCfg, NULL);
          if (status != CY_U3P_SUCCESS)
              CyU3PDebugPrint (4, "CyU3PI2sSetConfig failed, Error code = %X\n", status);
              CyFxAppErrorHandler (status);

        • 1. Re: I2S Register mode



          The source code of the FX3 SDK is given in C:\program Files (x86)\cypress\eZ-USB FX3 SDK\1.3\firmware\fx3_sdk_1_3_3_src.zip


          In that you can see the source of the CyU3PI2sSetConfig API in cyu3i2s.c file.


          In the code, there is the below statement:


           if ((!config->isDma) && (config->padMode !=
                  return CY_U3P_ERROR_BAD_ARGUMENT;


          This means in the register mode, only right justified padding (CY_U3P_I2S_PAD_MODE_RIGHT_JUSTIFIED) is supported.


          This is why the API was returning Bad Argument.




          - Madhu Sudhan