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.

Problem with GPIO in dm365

Hello:

be using the program IPNC, with microprocessor dm365.

I have a problem to enable the GPIO pin.
I use this example, which I have found.

int DRV_SetLED25(Bool enable)
{
    int status, value32,estado;
    static int gpioflag = 0;

    if (gpioflag == 0){
        status = CSL_gpioGetPinmux(&gCSL_gpioHndl, 3, &value32);

        if (status==OSA_SOK) {
            value32 &= ~(3<<29); // enable GPIO 25
            status=CSL_gpioSetPinmux(&gCSL_gpioHndl, 3, value32);
                     }

           
    DRV_gpioSetMode(25, DRV_GPIO_DIR_OUT);


        gpioflag ++;
          }

    
    if (enable==0){
        DRV_gpioClr(25);
    printf("--- Apagamos LED..\n");
    
          }
    else {
       DRV_gpioSet(25);
    printf("--- Encendemos LED..\n");


          }

   return 0;
}

 

The problem is that only work for the pin GPIO25.

Anyone know how it works? I do not understand the operation (value32 & = ~ (3 <<29), / / enable GPIO 25)
Someone know how to use this feature to activate any GPIO pin?

 

Thanks

 

 

  • Hi Josep,

    This piece of code is used to particularly toggle pin GPIO25.

    The operation (value32 &=~(3<<29) is to clear bits 29 and 30 which configures the GIO25 pin as GPIO function (instead of SPI0_SCS[0] or  PWM1 or UART1_TXD).

    It then calls the CSL_gpioSetPinmux(&gCSL_gpioHndl,3,value32), the parameter 3 is to set the pinmux register PINMUX3. Please refer to the section 9.12.5, Pin Mux 3 (PINMUX3) Register of the DM365 ARM SS UG (sprufg5a).

    If you want to activate any other GPIO pins you would need to modify this piece of code.

    Hope this helps.

    Thanks,

    Tai