BF609 single Interrupt with different interrupt source


I'm wondering if there is a solution that allows user use single interrupt but the source comes from different Pin? I believe "adi_gpio_RegisterCallback" will just over write the previous one.

For example, I have 4 different input signal go through PORT-E 01 - 04, and I'd like to use PINT3 to detect the raising edge event. Then the callback function can identify where is the interrupt comes from. 

If possible, can anyone provide me an example? I'm new to dsp, an example will be a great help.


  • +1
    •  Analog Employees 
    on Feb 13, 2021 1:15 AM 22 days ago


    You can use same Callback function for different input signals.
    void gpioCallback(ADI_GPIO_PIN_INTERRUPT ePinInt, uint32_t Data, void *pCBParam):
    epinInt - PINT module which rises interrupt.
    Data - contains PINT request register value.
    pCBparam- client passes parameter.

    Since processor is not mentioned, Let us give you an example snippet for your requirement.
    Assume that PORTE lower byte is assigned to PINT3_ASSIGN.B0MAP register (BYTE0 ) by default since you have menioned PORTE 1-4 pins.
    void gpioCallback(ADI_GPIO_PIN_INTERRUPT ePinInt, uint32_t Data, void *pCBParam)
    if (ePinInt == ADI_GPIO_PIN_INTERRUPT_3)
    if (Data & ADI_GPIO_PIN_1)
    /* TASK-1 */
    if (ePinInt == ADI_GPIO_PIN_INTERRUPT_3)
    if (Data & ADI_GPIO_PIN_2)
    /* TASK-2 */
    if (ePinInt == ADI_GPIO_PIN_INTERRUPT_3)
    if (Data & ADI_GPIO_PIN_3)
    /* TASK-3 */
    if (ePinInt == ADI_GPIO_PIN_INTERRUPT_3)
    if (Data & ADI_GPIO_PIN_4)
    /* TASK-4 */
    Please let us know if you need any further assistance.

    Santha kumari.K

  • Hi Santha,


    Are you suggesting that I can use function "adi_gpio_RegisterCallback" assign multiple interrupt source to same Callback function?  For example:

    // Port E pin 1:




    // Port E pin 2:




    // Port E pin 3:




    // Port E pin 4:





    Currently Im using : 

    adi_int_InstallHandler(INTR_PINT3_BLOCK, (ADI_INT_HANDLER_PTR)pintCallback_raising, NULL, true);

    Seems this is working as I expected. I'm wondering what's the difference between "adi_int_InstallHandler" and "adi_gpio_RegisterCallback"

    Thank you very much

  • 0
    •  Analog Employees 
    on Feb 17, 2021 5:07 PM 17 days ago in reply to Haoliang Deng


    Please find the details here

    For Q1:
    Yes correct. But you should incorporate conditional statements as we mentioned to check from which pins rise interrupt.

    For Q2:
    When you do right click on "adi_gpio_RegisterCallback" API and click "open Declaration" in CCES, you can find the adi_int_InstallHandler snippet inside its definition.
    adi_int_InstallHandler is used to install handler for particular Interrupt ID.
    It is not usually recommended to install handler for any interrupt directly,if your application is using SSLDD.
    Because in general,installation of handler for an interrupt in application simply overwrites the background default written installed handler for that particular interrupt which do the essential things for driver and may cause unexpected behaviour to your application.

    Assume you have registered "pintCallback_raising" user handler using adi_int_InstallHandler in main application.
    1.Once the handler is raised, user has to clear the latch bit for particular PINT inside the user handler.
    2.By doing as adi_int_InstallHandler(INTR_PINT3_BLOCK, (ADI_INT_HANDLER_PTR)pintCallback_raising, NULL, true);
    how can you find which pins rise interrupt if you are using this for multiple source for single PINT requirement? Even if you pass pin number as pCBparam to user handler, we can utilize handler for single source not for multiple.

    Here adi_gpio_RegisterCallback helps you to handle this case.
    Actually you need not care about clearing the latch and also find which pin,PINT rises the interrupt by easily getting back them as arguments in callback.
    adi_gpio_RegisterCallback ---> GPIOHandler (default driver handler) ---> pinIntCallback (user handler).
    Since GPIO is simple service, it may seem that registering the user handler using adi_int_InstallHandler irrespective of registering callback works fine but for peripheral drivers such as SPI,SPORT and UART it will definitely cause problems in application when application uses SSLDD.
    Hence it is always good practice to register callback instead of installing handler manually when you are using SSLDD.

    Best Regards,
    Santha kumari.K

  • Hi Santha,

    Thank you very much for your help. Seems like the callback function is working.

    But when I try add falling edge interrupt on the same pins, I don't know why they can't trigger callbacks.

    From my understandings, by default:

    Port E pin 1 can be sensed by PINT3 pin1 and PINT4 17.  

    Port E pin 2 can be sensed by PINT3 pin2 and PINT4 18.  

    Port E pin 3 can be sensed by PINT3 pin3 and PINT4 19.  

    Port E pin 4 can be sensed by PINT3 pin4 and PINT4 20.  

    In my program, I set Pint3 as raising edge, and PINT4 as falling edge interrupt. However, only Port E pin 1 can trigger both raising and falling, other Pins only can trigger raising interrupt.

    I attached my code below, if you have time, please take a look at it. Thank you, your time is highly appreciated.

  • +1
    •  Analog Employees 
    on Feb 22, 2021 4:57 AM 13 days ago in reply to Haoliang Deng


    While looking into your code, we understand that you have configured PINTs for PORTE 1-4 pins for rising and falling edges correctly.

    In order to narrow down the issue, Please try and provide the results for each following suggestions.
    1.Calling of adi_gpio_EnablePinInterruptMask API will clear latch for particular pin of PINT.
    So there is no need of additional statements to clear latch, please comment statements of clearing the latch (Eg: *pREG_PINT3_REQ = ADI_GPIO_PIN_1;*pREG_PINT3_LATCH = ADI_GPIO_PIN_1;) for all PINTs and try in this scenario.

    2.Comment out all PINTs configurations for rising edge, that means PINTs should be configured only for falling edge of four inputs. Please observe whether the callback for falling edge is occurred or not.

    3.If possible, Please try to probe four input signals whether they are properly switch back from rising to falling edges.

    Could you please explain more about your application and also the source of input signals. Hope that would help us to understand better.