This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Why nRF52832 can not add more than 4 buttons based the example "ble_app_uart" of nRF5_SDK_15.2.0_9412b96?

Dear all,

        When I added more than 4 buttons by modifying the example "ble_app_uart" of nRF5_SDK_15.2.0_9412b96, nRF52832 can not run normally.

            Another strangely problem that is from the debug output information, I find that the value of NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS is 4. But in the example code I find the value of NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS is 1 by macro defined in the file "sdk_config.h" and I searched all the project files and cannot find any place the the value of NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS is defined as 4. This problem also confused me.

I eagerly want to know how to resolve this problem when my project needing more than 4 buttons meanwhile initialize buttons by using example's  buttons_leds_init( ).

I also want to know which reason has resulted in NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS's value is 4 when in the project code it only be defined as 1. 

Thanks very much for your help.

  • Hi,

    You can adjust the define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS to the number of GPIOTE low-power events you need in your application. If you are adding e.g. 5 buttons, then you should set GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS and NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS to 5.

  • Dear,

           There are 7 buttons in my project, so  I modified the GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS and NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS as 7.

           The code can run in nRF52832, but there are 2 problems at the same time.

           Firstly,Button1 and Button 2 have no any response when I push any of them, but the Button 3 to Button 7 are work ok. 

           I also do an another test that I configure the Button1 as a wakeup button by bsp_wakeup_button_enable( ) in the function bsp_btn_ble_sleep_mode_prepare( ). But when I push the sleep button I find the nRF52832 exit from sleep mode immediately just like at the same time I pushed the sleep button. The following is my debug information.

         The GPIO pin 10 is the button 1. Actually the nRF52832 can not go into sleep mode at all when I configure the Button1 or Button 2 as wakeup button. And when I do not use Button1 or Button 2 as wakeup button, the nRF52832 can go into sleep mode successfully.

        Which reasons have result in this 2 problems?  I wish I could receive your useful guidance. 

        Thanks very much for your help.

  • Pin 9 and 10 are default configured for NFC, so if you plan to use pin 9 and pin 10, you will need to disable the NFC configuration of these pins. 

    Pin 9 and pin 10 can be used as GPIOs by defining the CONFIG_NFCT_PINS_AS_GPIOS variable in the project settings. The way of doing this depends on the Integrated Development Environment (IDE)/toolchain in use:


    When using Keil, go to Project > Options for Target > C/C++ > Preprocessor Symbols > Define and add the CONFIG_NFCT_PINS_AS_GPIOS variable.

    Hopefully this will solve both your problems.

  • Hi Sigurd,

            Firstly, thanks very much for your kind help. You are right and when I define the CONFIG_NFCT_PINS_AS_GPIOS in my project, the GPIO pin 9 and pin 10 can work normally.

           But now there is new problem turns up. In my project, button1 uses GPIO pin 10 and button2 uses GPIO pin 9. Every time when nRF52832 in sleep mode, I push any of button1 or button 2 , the content of NRF_GPIO->LATCH always 0x600. It confused me.The following is my debug information.

    (Because I find that even if I do not configure any wakeup key ,any button can also wakeup nRF52832 after has called buttons_leds_init( ). So I do not configure the button1 and button2 as wakeup key in my project. )

           

         Which reasons have resulted in NRF_GPIO->LATCH always 0x600 when I pushed different buttons using GPIO pin 9 and pin 10.

         I'm looking forward to your reply

Related