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

Custom Board - can't use more than 4 buttons

We did initial work on the NRF51DK (PCA_10028). We are using SDK 12 and ARM-GCC. We were able to compile and run successfully the experimental_ble_app_blinky and connect using your android App - nRF Blinky. We developed a custom board and were able to successfully run and connect to that with the experimental_ble_app_blinky. Our custom board has 6 buttons. I changed the C-FLAG to our custom board in the MAKEFILE and that seems to be working fine. If I add the other 2 buttons in the program, the program compiles fine (no errors) but will not broadcast BLE or have any other functionality. If I comment out any of 2 of the buttons in the static app_button_cfg statement, it works again. Here is the line below where it will work - if I take the comments out, it does not work.

static void buttons_init(void){
uint32_t err_code;

//The array must be static because a pointer to it will be saved in the button handler module.
static app_button_cfg_t buttons[] =
{
    {B1, false, BUTTON_PULL, button_event_handler},
    {B2, false, BUTTON_PULL, button_event_handler},
    {B3, false, BUTTON_PULL, button_event_handler},
    {B4, false, BUTTON_PULL, button_event_handler}
    //{B5, false, BUTTON_PULL, button_event_handler},
    //{B6, false, BUTTON_PULL, button_event_handler}
    
};

err_code = app_button_init(buttons, sizeof(buttons) / sizeof(buttons[0]),
                           BUTTON_DETECTION_DELAY);
APP_ERROR_CHECK(err_code);}

I defined the button's pins with - "#define B1 21" as an example. The button pins are 21,22,23,24,25,28.

What am I doing wrong? Is there something that I am not setting properly in another header file? I can make any 4 buttons work so I know the I/Os are good - I just can't make all 6 work. Any help would be appreciated.

Parents
  • With a custom board you will need to modify the board files. You can find the board files under:

    \SDK_INSTALL_FOLDER\examples\bsp
    

    When creating a new board file, simply copy the pca10028.h file, rename it, and modify it after your requirements. Then you have to modify boards.h to support your new file, and add a new define that you can specify in the makefile to include your modified file.

    A button press is a low power event, so you will also need to increase GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS which can be found in sdk_config.h.

Reply
  • With a custom board you will need to modify the board files. You can find the board files under:

    \SDK_INSTALL_FOLDER\examples\bsp
    

    When creating a new board file, simply copy the pca10028.h file, rename it, and modify it after your requirements. Then you have to modify boards.h to support your new file, and add a new define that you can specify in the makefile to include your modified file.

    A button press is a low power event, so you will also need to increase GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS which can be found in sdk_config.h.

Children
Related