AM5706: GPIO interrupt configuration for AM5706

Part Number: AM5706
Other Parts Discussed in Thread: SYSBIOS

Tool/software:

Hi, I'm using AM5706 processor and want to trigger and handle the interrupt coming at GPIO5_6 pin. I tried to use the GPIO APIs given in PDK folder(LED blink API) but not getting how to use those APIs, and also tried with accessing direct GPIO registers with this I'm also not getting the result. 

Thanks 

  • I'm using SYS/BIOS RTOS in CCS environment.

  • Hello Hardik,

    Are you using SYSBIOS only or also Linux on A15 core?

    Please share the versions of SW you are using.

    -Josue

  • Hi, I'm using only sysbios and SDK version processor_sdk_rtos_am57xx_08_01_00_09.

  • Did you successfully build the Blink LED example from PDK? 

  • You can also learn more by reading Chapter 17 of the TRM.

    -Josue

  • Hi, yes able to build it but when I'm copying code to my working project it is not working, gpio_init() function itself is crashing the code. 

  • I read it, there I'm not finding the register which will take the address of my ISR

  • Hardik,

    Just to make sure I understand I will reiterate the info you are telling me. You can build the example and successfully run it on your device, correct?

    The issue arises from when you are trying to port the example into your own application? Could you share any logs of the error logs? No messages when building?

    -Josue

  • Hi, actually I'm able to run the project for gpio led and able to trigger the interrupt, but what api they used for triggering the gpio interrupt is based on IRQ_STATUS_RAW0 register ( writing 1 to specific location triggered the interrupt for correspond pin of gpio), and I want to trigger the gpio interrupt whenever the gpio5_6 pin (DATA_IN register gets value 0 at the particular location correspond to specific pin of gpio) gets 0 as an data from external device.

    I'll try to give you logs by tomorrow.

  • Hi, the code attached below is based on GPIO port 5 (pin 6,7,8), I'm using this code to trigger the interrupt given by the TI led blink example code, they are using GPIOTriggerPinInt() for triggering the interrupt, I just don't want to use this API, and want to trigger the interrupt when some one is writing zero at the GPIO5_6,GPIO5_7,GPIO5_8, pins.

    am i doing something wrong for configuring the GPIO interrupt, if yes please correct me.

    #include <ti/csl/csl_utils.h>
    #include <ti/csl/soc/am571x/src/cslr_soc.h>
    #include <ti/csl/csl_types.h>
    #include <ti/drv/gpio/GPIO.h>
    #include <ti/drv/gpio/soc/GPIO_soc.h>
    #include <ti/drv/gpio/soc/GPIO_v1.h>
    #include <ti/csl/soc/am571x/src/cslr_soc_mpu_baseaddress.h>
    #include <ti/csl/hw_types.h>
    #include <ti/csl/csl_clec.h>
    
    /* Number of GPIO ports */
    #define CSL_GPIO_PER_CNT    8U
    
    /* GPIO Driver hardware attributes */
    GPIO_v1_hwAttrs_list GPIO_v1_hwAttrs = {
                                            {
                                             CSL_MPU_GPIO1_REGS,
                                             61,
    
                                             0,
                                             55,
                                             0
                                            },
                                            {
    
                                             CSL_MPU_GPIO2_REGS,
                                             62,
    
                                             0,
                                             56,
                                             0
                                            },
                                            {
    
                                             CSL_MPU_GPIO3_REGS,
                                             63,
    
                                             0,
                                             57,
                                             0
                                            },
                                            {
    
                                             CSL_MPU_GPIO4_REGS,
                                             64,
    
                                             0,
                                             58,
                                             0
                                            },
                                            {
    
                                             CSL_MPU_GPIO5_REGS,
                                             65,
    
                                             0,
                                             59,
                                             0
                                            },
                                            {
    
                                             CSL_MPU_GPIO6_REGS,
                                             66,
    
                                             0,
                                             60,
                                             0
                                            },
                                            {
    
                                             CSL_MPU_GPIO7_REGS,
                                             67,
    
                                             0,
                                             61,
                                             0
                                            },
                                            {
    
                                             CSL_MPU_GPIO8_REGS,
                                             153,
    
                                             0,
                                             0,
                                             0
                                            },
    };
    
    /* GPIO configuration structure */
    CSL_PUBLIC_CONST GPIOConfigList GPIO_config =
    {
     {
      &GPIO_FxnTable_v1,
      NULL,
      NULL
     },
     /* "pad to full predefined length of array" */
     {
      NULL,
      NULL,
      NULL
     },
     {
      NULL,
      NULL,
      NULL
     }
    };
    
    /* Callback function */
    void AppGpioCallbackFxn1(void);
    void AppGpioCallbackFxn2(void);
    void AppGpioCallbackFxn3(void);
    void AppGPIOInit(void);
    
    /**********************************************************************
     ************************** Global Variables **************************
     **********************************************************************/
    
    uint32_t gpioBaseAddr;
    uint32_t gpioPin;
    
    /* GPIO pin number connected to the green LED */
    #define GPIO_6_PIN_NUM      (0x6)
    
    /* GPIO port number connected to the green LED */
    #define GPIO_PORT_NUM       (0x5)
    
    /* GPIO pin number connected to the yellow LED */
    #define GPIO_7_PIN_NUM      (0x7)
    
    /* GPIO pin number connected to the yellow LED */
    #define GPIO_8_PIN_NUM      (0x8)
    
    
    /* GPIO Driver board specific pin configuration structure */
    GPIO_PinConfig gpioPinConfigs[] = {
                                       /* Input pin with interrupt enabled */
                                       GPIO_DEVICE_CONFIG(GPIO_PORT_NUM, GPIO_6_PIN_NUM) |
                                       GPIO_CFG_IN_INT_FALLING | GPIO_CFG_INPUT,
    								   
                                       /* Input pin with interrupt enabled */
                                       GPIO_DEVICE_CONFIG(GPIO_PORT_NUM, GPIO_7_PIN_NUM) |
                                       GPIO_CFG_IN_INT_FALLING | GPIO_CFG_INPUT,
    
                                       /* Input pin with interrupt enabled */
                                       GPIO_DEVICE_CONFIG(GPIO_PORT_NUM, GPIO_8_PIN_NUM) |
                                       GPIO_CFG_IN_INT_FALLING | GPIO_CFG_INPUT
    
    };
    
    /* GPIO Driver call back functions */
    GPIO_CallbackFxn gpioCallbackFunctions[] = {
                                                &AppGpioCallbackFxn1,
                                                &AppGpioCallbackFxn2,
                                                &AppGpioCallbackFxn3
                                                //                                            NULL,
                                                //                                            NULL,
                                                //                                            NULL
    };
    
    /* GPIO Driver configuration structure */
    GPIO_v1_Config GPIO_v1_config = {
                                     gpioPinConfigs,
                                     gpioCallbackFunctions,
                                     sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig),
                                     sizeof(gpioCallbackFunctions) / sizeof(GPIO_CallbackFxn),
                                     0x20,
    };
    
    
    /*
     *  ======== AppGPIOInit ========
     */
    void AppGPIOInit(void)
    {
        /* GPIO5 Clock Enable */
        *(unsigned int*)0x4A009778 = (unsigned int)(0x00000102);
    
        /* Pinmux for GPIO5_6 */
        *(unsigned int*)0x4A0036C4 = (unsigned int)(0x0000000EU);
    
        /* Pinmux for GPIO5_7 */
        *(unsigned int*)0x4A0036C8 = (unsigned int)(0x0000000EU);
    
        /* Pinmux for GPIO5_7 */
        *(unsigned int*)0x4A0036CC = (unsigned int)(0x0000000EU);
    }
    unsigned int ret_val;
    
    
    void gpio_test(UArg arg0, UArg arg1)
    {
        uint32_t testOutput = 0;
    
    
        AppGPIOInit();
    	
        /* GPIO initialization */
        GPIO_init();
    
        GPIO_setCallback(0, AppGpioCallbackFxn1);
    
        /* Enable GPIO interrupt on the specific gpio pin */
        GPIO_enableInt(0);
    
        /* Set the callback function */
        GPIO_setCallback(1, AppGpioCallbackFxn2);
    
        /* Enable GPIO interrupt on the specific gpio pin */
        GPIO_enableInt(1);
    
        /* Set the callback function */
        GPIO_setCallback(2, AppGpioCallbackFxn3);
    
        /* Enable GPIO interrupt on the specific gpio pin */
        GPIO_enableInt(2);
    
    
    
        GPIOTriggerPinInt(0x4805B000, 0, 6);
    
        GPIOTriggerPinInt(0x4805B000, 0, 7);
    
        GPIOTriggerPinInt(0x4805B000, 0, 8);
    
        }
    
    
    // *  ======== Callback function ========
    void AppGpioCallbackFxn1(void)
    {
    	UART_printf("interrupt triggered for GPIO5-6------------------------------------- \n");
        ret_val = GPIOPinRead(0x4805B000, 6);
        UART_printf("in  GPIO 6 0x%x\n",ret_val);
    }
    
    void AppGpioCallbackFxn2(void)
    {
        UART_printf("interrupt triggered for GPIO5-7------------------------------------- \n");
        ret_val = GPIOPinRead(0x4805B000, 7);
        UART_printf("in  GPIO 7 0x%x\n",ret_val);
    }
    
    void AppGpioCallbackFxn3(void)
    {
        UART_printf("interrupt triggered for GPIO5-8------------------------------------- \n");
        ret_val = GPIOPinRead(0x4805B000, 8);
        UART_printf("in  GPIO 8 0x%x\n",ret_val);
    }

  • Hi Hardik, 

    Could you please tell me what core are you building this for?

    -Josue

  • Hi, for A15 core 0 I'm building this code.

  • Thanks! I will try to take a look at this by the end of this week, might not get back to you until next week.

    -Josue

  • Okay, I'll also try more from my side.

  • Hi josue, I'll explain my connection of ti processor, I have connected the arinc chip(HI- 3220) through spi interface to the ti processor, and the int pin of arinc chip is connected to the gpio5_6 pin of the ti processor, as soon as arinc will receive the data it will trigger the interrupt and make the int pin low, this should generate the interrupt at gpio5_6 of the ti processor.

    Apart from this I want to ask if there is any register for the ti am5706 to which I have to assigned my ISR address, if it is there, can you please send me the small snippet of assigning isr to the register for interrupt?

  • Hello Hardik,

    I am out of the office until 1/22. Please expect delays in reply.

    -Josue

  • Okay Josue, no problem.