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.

TDA2HG: TDA2XX linux VSDK0305 IPU2 GPIO interrupt

Part Number: TDA2HG

Hi, master

   complete code:

//gpio2_6
#define gpio_pin    6   //14//6 //14// //gpio2-6
uint32_t gpio_base_address = SOC_GPIO2_BASE;
uint32_t interrupt_num     = 52;//30//26;//51//52//29;//6;

#define IRQ_XBAR_CPU_ID         CSL_XBAR_IRQ_CPU_ID_IPU1
#define IRQ_XBAR_INST_NO        CSL_XBAR_INST_IPU2_IRQ_52//CSL_XBAR_INST_IPU1_IRQ_33
#define IRQ_XBAR_INDEX          CSL_XBAR_GPIO2_IRQ_1//CSL_XBAR_DSP1_IRQ_MMU0


//isr thread
void gpioIsr(void *arg)
{
    Vps_printf("I");
    //GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);  //cam4 934 intb //GPIO2_6_PD cam4 int
#if 1
    uint32_t gpio_pin_value;//,cam4_pin_value = 6;

    /*Disable interrupt*/
    GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);  //cam4 934 intb //GPIO2_6_PD cam4 int
    /*Read pin*/
    gpio_pin_value = GPIOPinRead(gpio_base_address, gpio_pin);
    GPIOPinIntClear(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
    printf( "I\n");
     /*Enable interrupt interrupt*/
    GPIOPinIntEnable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
#endif   
}


int cam_intb_init(void)
{
    //m4pid0
    /*Configure interrupt controller*/

    BspOsal_irqXbarConnect(CSL_XBAR_INST_IPU2_IRQ_52,CSL_XBAR_GPIO2_IRQ_1);
    BspOsal_registerIntr(interrupt_num,gpioIsr,(void *) 0);
    GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
#if 1   
  
    /*Enable GPIO*/
    GPIOModuleEnable(gpio_base_address);
    /*Configure and enable debouncing feature*/
    GPIODebounceTimeConfig(gpio_base_address, 0xFF);
    Vps_printf("GPIODebounceTimeConfig\n");
    GPIODebounceFuncControl(gpio_base_address, gpio_pin,
                            GPIO_DEBOUNCE_FUNC_ENABLE);
    Vps_printf("GPIODebounceFuncContro\n");
    GPIOIntTypeSet(gpio_base_address, gpio_pin,GPIO_INT_TYPE_FALL_EDGE);    
    Vps_printf("GPIOIntTypeSet\n");
    /* Set pin direction as input*/
    GPIODirModeSet(gpio_base_address, gpio_pin, GPIO_DIR_INPUT);
    Vps_printf("GPIODirModeSet\n");
    /*Clear interrupt*/
    GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
    Vps_printf("GPIOPinIntDisable\n");
    GPIOPinIntClear(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
    Vps_printf("GPIOPinIntClear\n");

    /*Enable interrupt*/
    GPIOPinIntEnable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
    Vps_printf("GPIOPinIntEnable\n");
#endif

    return 0;

}

   I am not sure if the interrupt_num = 52 and gpio_pin = 6 of gpio2_6 are correct.

I'm not sure GPIO2_6 is configured correctly as follows

BspOsal_irqXbarConnect (CSL_XBAR_INST_IPU2_IRQ_52, CSL_XBAR_GPIO2_IRQ_1);

  • my board boot as linux target, 

    I want make a gpio interrupt on M4[ipu2], 

    GPIO is GPIO2_6.

    SDK: PROCESSOR_SDK_VISION_03_05_00_00.


    my code
    //gpio2_6
    #define gpio_pin    6   //14//6 //14// //gpio2-6
    uint32_t gpio_base_address = SOC_GPIO2_BASE;
    uint32_t interrupt_num     = 52;//30//26;//51//52//29;//6;
    
    #define IRQ_XBAR_CPU_ID         CSL_XBAR_IRQ_CPU_ID_IPU1
    #define IRQ_XBAR_INST_NO        CSL_XBAR_INST_IPU2_IRQ_52//CSL_XBAR_INST_IPU1_IRQ_33
    #define IRQ_XBAR_INDEX          CSL_XBAR_GPIO2_IRQ_1//CSL_XBAR_DSP1_IRQ_MMU0
    
    
    //isr thread
    void gpioIsr(void *arg)
    {
        Vps_printf("I");
        //GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);   //GPIO2_6_PD int
    #if 1
        uint32_t gpio_pin_value;//,cam4_pin_value = 6;
    
        /*Disable interrupt*/
        GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);   //GPIO2_6_PD int
        /*Read pin*/
        gpio_pin_value = GPIOPinRead(gpio_base_address, gpio_pin);
        GPIOPinIntClear(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
        printf( "I\n");
         /*Enable interrupt interrupt*/
        GPIOPinIntEnable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
    #endif   
    }
    int cam_intb_init(void)
    {
    //m4pid0
    /*Configure interrupt controller*/ 
    BspOsal_irqXbarConnect(52 /*CSL_XBAR_INST_IPU2_IRQ_52*/,CSL_XBAR_GPIO2_IRQ_1);
    BspOsal_registerIntr(interrupt_num,gpioIsr,(void *) 0);
    GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
    #if 0 
    /*Enable GPIO*/
    GPIOModuleEnable(gpio_base_address);
    /*Configure and enable debouncing feature*/
    GPIODebounceTimeConfig(gpio_base_address, 0xFF);
    Vps_printf("GPIODebounceTimeConfig\n");
    GPIODebounceFuncControl(gpio_base_address, gpio_pin,
    GPIO_DEBOUNCE_FUNC_ENABLE);
    Vps_printf("GPIODebounceFuncContro\n");
    #endif
    GPIOIntTypeSet(gpio_base_address, gpio_pin,GPIO_INT_TYPE_FALL_EDGE); 
    Vps_printf("GPIOIntTypeSet\n");
    /* Set pin direction as input*/
    GPIODirModeSet(gpio_base_address, gpio_pin, GPIO_DIR_INPUT);
    Vps_printf("GPIODirModeSet\n");
    /*Clear interrupt*/
    GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
    Vps_printf("GPIOPinIntDisable\n");
    GPIOPinIntClear(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
    Vps_printf("GPIOPinIntClear\n");
    
    /*Enable interrupt*/
    GPIOPinIntEnable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
    Vps_printf("GPIOPinIntEnable\n");
    
    
    return 0;
    
    }

    In the above code, gpio2_6 is configured as interrupt_num=52 and gpio_pin=6. When gpio2_6 is pulled down externally, an interrupt can occur, but with the following exception, the log is thrown as follows

    [HOST] [HOST ] ====================
    [HOST] [HOST ] Chains Run-time Menu
    [HOST] [HOST ] ====================
    [HOST] [HOST ]
    [HOST] [HOST ] 0: Stop Chain
    [HOST] [HOST ]
    [HOST] [HOST ] p: Print Performance Statistics
    [HOST] [HOST ]
    [HOST] [HOST ] Enter Choice:
    [HOST] [HOST ]
    [HOST] [IPU2 ] 21.181754 s: CAPTURE: Start Done !!!

    [HOST] [HOST ] 21.243152 s:
    [HOST] [HOST ] Unsupported option '
    [HOST] [HOST ] '. Please try again
    [HOST] [HOST ] 21.243152 s:
    [HOST] [HOST ]
    [HOST] [HOST ] ====================
    [HOST] [HOST ] Chains Run-time Menu
    [HOST] [HOST ] ====================
    [HOST] [HOST ]
    [HOST] [HOST ] 0: Stop Chain
    [HOST] [HOST ]
    [HOST] [HOST ] p: Print Performance Statistics
    [HOST] [HOST ]
    [HOST] [HOST ] Enter Choice:
    [HOST] [HOST ]

        When gpio2_6 is pulled down externally, hrow the following exception log:

    [ 21.270423] irq 77, desc: eea1f000, depth: 1, count: 0, unhandled: 0
    [ 21.271239] ->handle_irq(): c007fd88, handle_bad_irq+0x0/0x280
    [ 21.272009] ->irq_data.chip(): eea1e9d0, 0xeea1e9d0
    [ 21.272640] ->action(): (null)
    [ 21.273055] IRQ_NOPROBE set
    [ 21.273448] unexpected IRQ trap at vector 4d
    [HOST] [IPU2 ] 24.714542 s: I
    [HOST] [IPU2 ] 24.714664 s:
    [HOST] [IPU2 ] 24.714695 s: ### XDC ASSERT - ERROR CALLBACK START ###
    [HOST] [IPU2 ] 24.714756 s:
    [HOST] [IPU2 ] 24.714908 s: assertion failure: A_badContext: bad calling context. See GateMutex API doc for details.
    [HOST] [IPU2 ] 24.715000 s:
    [HOST] [IPU2 ] 24.715030 s: ### XDC ASSERT - ERROR CALLBACK END ###
    [HOST] [IPU2 ] 24.715091 s:

     

  • Hi,

    can you make sure you have disabled those gpio's in Linux, see this post for details:

    Regards,

    Yordan

  • Hi,

    Is there an update on this?

    Regards,

    Rishabh

  • Hi,

    I haven't heard back from you, I'm assuming you were able to resolve your issue.
    If not, just post a reply below (or create a new thread if the thread has locked due to time-out).

    Regards,
    Rishabh