This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

c6455 gpio error code

Hi,

I am using C6455 to communicate with fpga, using CCS3.3.

And I need to toggle a gpio[6] to reset fpga. But sometimes, I will see error in gpio.

below my code to toggle the gpio:

    cPinFpgaReset = CSL_GPIO_PIN6;
    //asm("    NOP 1000");
    status = CSL_gpioHwControl (hGpio, CSL_GPIO_CMD_CLEAR_BIT, &cPinFpgaReset);
    if(CSL_SOK != status )
    {
        printf("clear the cPinFpgaReset failed, status = %X\n",status);;
    }
    //status = CSL_gpioHwControl (hGpio, CSL_GPIO_CMD_GET_INPUTBIT, &pinGpioStatus);
    cgIpGpio = (pinGpioStatus & 0xf000)>>12;

    status = CSL_gpioHwControl (hGpio, CSL_GPIO_CMD_SET_BIT, &cPinFpgaReset);
    if(CSL_SOK != status )
    {
        printf("clear the cPinFpgaReset failed, status = %X\n",status);
    }

If I add no optimization, above code works.

but if I comment "cgIpGpio = (pinGpioStatus & 0xf000)>>12;", above code failed.and the error code is "0xFFFFFEDF"

what this error code means? I can not find this error code in csl manual.

Thanks

Guoxing

  • Guoxing,

    1. Find the GPIO module's User Guide to see which register bits are needed for manipulation of the GPIO pins. You will also see how to control and program them at the lower level.

    2. Find the CSL source for the function that is failing. This is not obvious from your post, above, exactly where the program is failing. In the CSL source you can find which error return code has the value that you see returned as an error code.

    Regards,
    RandyP

  • Thanks for your help.

    Sorry for the late respond, I am working on other project.

    I still don't know why see the error. I just give up using CSL. Directly using register is good.

    Below is my code:

    #define   GPIO_IN_DATA  (*((volatile Uint32 *)0x02B00020))
    #define   GPIO_SET_DATA (*((volatile Uint32 *)0x02B00018))
    #define   GPIO_CLR_DATA (*((volatile Uint32 *)0x02B0001C))

        asm("    NOP 9");
        GPIO_CLR_DATA |= 0x40;
        asm("    NOP 9");
        uPinGpioStatus = GPIO_IN_DATA & 0x40;
        if(uPinGpioStatus != 0 )
        {
            printf("clear the gpio failed, status = 0x%X,uPinGpioStatus = 0x%X\n",GPIO_IN_DATA,uPinGpioStatus);
        }
        
        GPIO_SET_DATA |=  0x40;
        asm("    NOP 9");
        uPinGpioStatus = GPIO_IN_DATA & 0x40;
        if(uPinGpioStatus != 0x40 )
        {
            printf("Set the gpio failed, status = 0x%X,uPinGpioStatus = 0x%X\n",GPIO_IN_DATA,uPinGpioStatus);
        }

  • Hi Guoxing,

    If I add no optimization, above code works.

    but if I comment "cgIpGpio = (pinGpioStatus & 0xf000)>>12;", above code failed.and the error code is "0xFFFFFEDF"

    what this error code means? I can not find this error code in csl manual.

    Are you meant that if you use default optimization, you are getting error right ?

    How did you get this error code ?

    Are you running this code through CCS ?

    Then you can see the status of GPIO registers through registers window.