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

Disable Default PCA10056 Board / Button Handling

Hello,

I want to install my own Button & LED handling (not using the default board support). It works on the nRF52840 Dongle, but I also want it to work on the PCA10056 Board where I can debug.


*** No board support header files or c-files is included in the project. ***


On the Dongle I have configured 4 pins for Button Handling:

#define BUTTON_1 2 // P0.02 --> 0 + 2
#define BUTTON_2 47 // P1.15 --> 32 + 15
#define BUTTON_3 45 // P1.13 --> 32 + 13
#define BUTTON_4 42 // P1.10 --> 32 + 10


On the PCA10056 Board:

#define BUTTON_1 39
#define BUTTON_2 40
#define BUTTON_3 24
#define BUTTON_4 25


The following is set in sdk_config.h:

BSP_BTN_BLE_ENABLED 0

BUTTON_ENABLED 0

BLE_LBS_C_ENABLED 0


Buttons are set up as follows, using Button 1 as an example:


nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(false); // true means high accuracy
in_config.pull = NRF_GPIO_PIN_PULLUP;


err_code = nrf_drv_gpiote_in_init(BUTTON_1, &in_config, casting_power_on_pin_handler);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(BUTTON_1, true);


// I disable some buttons when they are pressed in the Event Handlers (and enable them again when others are pressed)

// Eg.g BUTTON_1 is Disabled with this code

nrf_gpio_cfg_sense_input(BUTTON_1, GPIO_PIN_CNF_PULL_Pullup, NRF_GPIO_PIN_NOSENSE);


// And later re-enabled with this code in another Button Event handler:

nrf_gpio_cfg_sense_input(BUTTON_1, GPIO_PIN_CNF_PULL_Pullup, NRF_GPIO_PIN_SENSE_LOW);

*** All this works on the Dongle, but on the PCA10056 (1.0.0 2018.35) only BUTTON_3 & BUTTON_4 works. ***

I have tried to move SW7 to the ALT positon and use the alternate Pins for BUTTON_1 (11) and BUTTON_2 (12), but that does not work either.


Can someone please help ?

Parents
  • Hi,

    *** All this works on the Dongle, but on the PCA10056 (1.0.0 2018.35) only BUTTON_3 & BUTTON_4 works. ***

     So what behavior are you seeing with BUTTON_1 and BUTTON_2, nothing works ?

    #define BUTTON_1 39
    #define BUTTON_2 40

     You are testing with P1.07(39) and P1.08(40), correct ?

    PS: It might be better to use the NRF_GPIO_PIN_MAP() macro for mapping port and pin numbers.

    Snippet:

    #define BUTTON_1       NRF_GPIO_PIN_MAP(1,7)

  • Hello Sigurd,

    Thanks for your fast reply, and sorry for my late reply: I got caught up in tons of other stuff I also needed to take care of: I am doing a project where we are testing nRF52840 :-)

    Thanks for the tip on using NRF_GPIO_PIN_MAP(1,7)!

    Yes I am testing with P1.07(39) and P1.08(40).

    <<So what behavior are you seeing with BUTTON_1 and BUTTON_2, nothing works ?>>

    Well, nothing happens: I try to set a break point in the event handlers, but code never gets there.

    What I do see though, when measuring the current, is that even though I have Pull Ups on all Button Ports , I do not see increased current when I push the Button 1 & 2: That I do see on button 3 & 4: And for Button 3, the code does stop at any break point I set in the Event Handler.

    So what do you think is the problem?

  • I have tried to move SW7 to the ALT positon and use the alternate Pins for BUTTON_1 (11) and BUTTON_2 (12), but that does not work either.

    Have you connect something to P1.07(39) and P1.08(40) ?

    By default this switch should be in the "Def" position, and the physical "Button 1" and "Button 2" is connected to pin P0.11 and P0.12. Are these working for you?

Reply Children
Related