1 Reply Latest reply on Jul 1, 2011 6:48 AM by sangramm_16

    CyU3PI2cSetConfig problem

    user_136061072

      Hello,

         

      I try to get the I2C interface working without DMA.

         

      My initialisation looks like following:

         

          CyU3PReturnStatus_t status = CY_U3P_SUCCESS;
          CyU3PI2cConfig_t config;

          CyU3PDebugPrint (4, "CyU3PI2cInit...\r\n");
          status = CyU3PI2cInit();
          if(status != CY_U3P_SUCCESS){
              CyU3PDebugPrint (4, "CyU3PI2cInit Failed, Error Code = %x\r\n",status);
              return status;
          }

          config.bitRate = 100000;
          config.isDma = CyFalse;
          config.busTimeout = 0xFFFFFFFFU;
          config.dmaTimeout = 0xFFFF;

          status = CyU3PI2cSetConfig(&config, &IS_I2cIR);
          if(status != CY_U3P_SUCCESS)
          {
              CyU3PDebugPrint (4, "CyU3PI2cSetConfig Failed, Error Code = %x\r\n",status);
              return status;
          }

         

         CyU3PI2cSetConfig fails with errorcode CY_U3P_ERROR_BAD_ARGUMENT.

         

         When setting "config.isDma = CyTrue", CyU3PI2cSetConfig returns with CY_U3P_SUCCESS.

         

         What could be wrong?

         

         Best regards

         

         g.

        • 1. Re: CyU3PI2cSetConfig problem
          sangramm_16

          Hi,

             

          In the function CyU3PI2cSetConfig, the second argument is the callback. This callback is used only when the DMA mode is used. So if the DMA mode is set to CyFalse, then you dont need to pass this callback argument. This is triggering the BAD_ARGUMENT error.

             

          Thanks,

             

          SKSM