zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.67k stars 6.52k forks source link

STM32 b_u585i_iot02a_ns, problems with gpio_pin_interrupt_configure #58052

Closed JiiZR closed 1 year ago

JiiZR commented 1 year ago

Describe the bug I was trying to use two GPIO interrupts, different port but same pin number. Second pin gpio_pin_interrupt_configure fails: failed to configure interrupt gpio_e, ret:-16

Interrupts are working, tested separately but if port number is same then second always gives -16, EBUSY. Is this a bug or platform limitation or user error ?

To Reproduce Steps to reproduce the behavior:

  1. west build -p auto -b b_u585i_iot02a_ns samples\basic\blinky
  2. west flash
  3. See error

Expected behavior No error prints and both interrupts should work

Impact Limits pin usage

Logs and console output

Booting Zephyr OS build zephyr-v3.3.0-4047-g49389b546a4a gpio_d intr init done failed to configure interrupt gpio_e, ret:-16 gpio_e intr init done

Environment (please complete the following information):

Additional context Add any other context that could be relevant to your issue, such as pin setting, target configuration, ... main.c.txt

erwango commented 1 year ago

Proposed code is doing the following:

    ret = gpio_pin_interrupt_configure(gpio_d_dev, 15, GPIO_INT_EDGE_FALLING );
        ...
        ret = gpio_pin_interrupt_configure(gpio_e_dev, 15, GPIO_INT_EDGE_FALLING);

Please note (see ref man) that there is only one interrupt line for all GPIO ports. Trying to use line 14 on gpio_e will work. See https://github.com/zephyrproject-rtos/zephyr/issues/45234 for a, finally impossible, attempt to work around it.

Note, I'm converting this to discussion.