CyU3PI2cSetConfig problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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.

0 Likes
1 Reply
Anonymous
Not applicable

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

0 Likes