Error with GPIOTE interrupt configuration nRF5340

Hi.

I have following error:

gen_isr_tables.py: error: multiple registrations at table_index 13 for irq 13 (0xd)

Existing handler 0x31a7d, new handler 0x9df1

Here is my prj.conf : 

# Peripheral drivers

# I2C
CONFIG_NRFX_TWIM1=y

# Timer
CONFIG_NRFX_TIMER2=y

# GPIO
CONFIG_NRFX_GPIOTE0=y
CONFIG_NRFX_GPIOTE_NUM_OF_EVT_HANDLERS=5

# Flash
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y

# Others
CONFIG_NRFX_PWM0=y
CONFIG_NRFX_SPIM2=y
CONFIG_NRFX_RNG=y
CONFIG_NRFX_UARTE0=y
CONFIG_NRFX_NVMC=y

# BLE
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_CTLR_CONN_RSSI=y
CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y
CONFIG_BT_MAX_CONN=1

# Power management
CONFIG_POWEROFF=y
CONFIG_RESET_ON_FATAL_ERROR=y

# Logging
CONFIG_USE_SEGGER_RTT=y

# Enable printf floating point support beware this take up to 7ko of flash
CONFIG_CBPRINTF_FP_SUPPORT=y

# Build options
CONFIG_BUILD_NO_GAP_FILL=y
CONFIG_MAIN_STACK_SIZE=8192

# Needed to share interrupts line and avoid irq conflict? see https://docs.zephyrproject.org/latest/kernel/services/interrupts.html#sharing-interrupt-lines
# CONFIG_SHARED_INTERRUPTS=y


I would like to avoid using CONFIG_SHARED_INTERRUPTS.
Only GPIOTE0 is on IRQ number 11 so I couldn't have connected this number twice. The only way is I have connected GPIOTE0 IRQ twice, but I don't understand how.
Here is how I connect the IRQ:
    IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_GPIOTE_INST_GET(0)), IRQ_PRIO_LOWEST,
                NRFX_GPIOTE_INST_HANDLER_GET(0), 0, 0);
By searching IRQ_CONNECT and IRQ_DIRECT_CONNECT in my IDE, I don't see any doubled instruction. Others IRQ_CONNECT are for other perihperal (that can't have the same number if I got this correctly).
What am I missing? Thank you for your help
Parents
  • It could be that it is getting configured through zephyr and 2nd time you are configuring manually.

    Maybe this Q&A page could shed more light on this: Using GPIOTE and Zephyr API

  • Hi, 

    Unfortunately, I don't use Zephyr API to drive GPIOs. I only use nrfx layer so that QA doesn't apply.

    What other functions could lead to same behavior as IRQ_CONNECT? 

    Regarding this : 

    Existing handler 0x31a7d, new handler 0x9df1

    Is there a way to identify the handlers? It could help me point out the issue. Thank you for your help

  • I commented the IRQ_CONNECT in my gpio file to see further and I got this error :

    gen_isr_tables.py: error: multiple registrations at table_index 9 for irq 9 (0x9)
    Existing handler 0x319b5, new handler 0x319b5

    The thing is, I commented out ALL IRQ_CONNECT and IRQ_DIRECT_CONNECT in my code just to be sure, and all IRQ_CONNECT related to TWIM are located in sample codes, which are not compiled.

    I even commented out all my main, to keep only twim init. How come I have this error? I feel like I miss a crucial point here. 

  • Back to the original issue. I finnally found where IRQ_CONNECT is called. It is in gpio_nrfx.c : 

    #define GPIOTE_IRQ_HANDLER_CONNECT(node_id) \
    	IRQ_CONNECT(DT_IRQN(node_id), DT_IRQ(node_id, priority), nrfx_isr, \
    		    NRFX_CONCAT(nrfx_gpiote_, DT_PROP(node_id, instance), _irq_handler), 0);
    
    static int gpio_nrfx_init(const struct device *port)
    {
    	const struct gpio_nrfx_cfg *cfg = get_port_cfg(port);
    	nrfx_err_t err;
    
    	if (!has_gpiote(cfg)) {
    		return 0;
    	}
    
    	if (nrfx_gpiote_init_check(&cfg->gpiote)) {
    		return 0;
    	}
    
    	err = nrfx_gpiote_init(&cfg->gpiote, 0 /*not used*/);
    	if (err != NRFX_SUCCESS) {
    		return -EIO;
    	}
    
    #ifdef CONFIG_GPIO_NRFX_INTERRUPT
    	nrfx_gpiote_global_callback_set(&cfg->gpiote, nrfx_gpio_handler, NULL);
    	DT_FOREACH_STATUS_OKAY(nordic_nrf_gpiote, GPIOTE_IRQ_HANDLER_CONNECT);
    #endif /* CONFIG_GPIO_NRFX_INTERRUPT */

    thing is, it works fine with the exact same code, but for nrf52 (why?). The only things that differs are the dts files, and the responsible for the first IRQ_CONNECT error in the case of nrf53 is the qspi configuration in nrf5340_cpuapp_common.dts : 

    &qspi {
    	status = "okay";
    
    	pinctrl-0 = <&qspi_default>;
    	pinctrl-1 = <&qspi_sleep>;
    	pinctrl-names = "default", "sleep";
    	nrf700x: nrf7002@1 {
    		status = "okay";
    		compatible = "nordic,nrf700x-qspi";
    		reg = <1>;
    		sck-frequency = <24000000>;
    		quad-mode;
    		/* Wi-Fi Pins used */
    		iovdd-ctrl-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
    		bucken-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
    		host-irq-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
    	};
    };

    If I comment this it is okay. Why? I will need the nrf7002 connection eventually. How can I know what does what in the dts? 

  • Hi Benoit,

    Apologies for the delayed response due to high work load.

    What is status of your project? This ticket talks about the IRQ conflicts using NRf5340. IRQ conflicts 5340

    As nrf5340 has 2 cores as compared with the nrf52 chips, it could be more difficult to debug.

    Nonetheless, if you could send a minimal project that would produce the issue you are facing then I can dig into it.

Reply Children
No Data
Related