nRF5340 Audio application - moving button5 to gpio1 instead of gpio0

Hello!

Using SDK v2.6.1 and the nRF5340 Audio application, I want to use an external button as button5 instead of the one that is on the board.

I noticed that if i change the device tree to use an unused pin on gpio1, it does not seem to work. 

In src/bluetooth/bt_management/bt_mgmt.c, I added a print in the bonding_clear_check() function to see the value of BUTTON_5. When I run the application with the original device tree (gpio0 5), i see that the value is 5. If I change the device tree (gpio1 5 instead), it still shows at 5. This leads me to believe that it is not accessing the correct GPIO since I would expect it to be 37 (5 + 32).

Looking more closely, in src/modules/button_assignments.h, I see the button list which is giving BUTTON_5 its value. 

`BUTTON_5 = DT_GPIO_PIN(DT_ALIAS(sw4), gpios)`
I tried doing + 32 here directly as suggested in this post, but then I get "Unsupported pin" error. 
Note: I've tested with other gpio0 pins and it works fine.
Could you explain what needs to be changed in order to move button5 to gpio1?
 
Cheers.
Parents Reply
  • Hello Susheel,

    Thanks for the reply.

    What is the API that gives this error?

    The error originates from the ASSERT in `zephyr/include/zephyr/drivers/gpio.h` at line 1001.

    	__ASSERT((cfg->port_pin_mask & (gpio_port_pins_t)BIT(pin)) != 0U,
    		 "Unsupported pin");

    I have no issues with gpios that are outputs on gpio1. But trying to set an input button on gpio1 with the nRF5340 Audio app is causing problems. If i switch to another pin on gpio0, its fine and works fine. Any insights?

Children
No Data
Related