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

How to use the SDK board support package with custom board having more than 8 button

I wanted to use the sdk board support file with coustom board having 13 buttons. I have modified the bsp.c and configer number of low power events and added a coustom header. However, it seems like the device reset rondomely when using sdk11 and on sdk 14 “Fatal:” log messge appers rondomey from app_error_fault_handler in app_error_weak.c file. How do i fix this, Is it worng to impliment morethan 8 button.

custom_board.h

Parents
  • Hello sami

    You say you have modified bsp.c? What changes have you made here? It should not be necessary to change bsp.c for a custom board. The board support module (bsp) uses the defines in sdk_config.h and in pca10028.h/pca10040.h /pca10056.h/custom_board.h, and as long as you provide it with one of the mentioned files with the appropriate defines it should work as intended.

    As you have tried SDK14 I assume you are using the nRF52 series?

    Are you only using low power events (low accuracy)? Do keep in mind the nRF51 supports a maximum of 4 GPIOTE channels (used for high accuracy), and the nRF52 has 8 channels.

    In your case you would add a custom_board.h, as well as the BOARD_CUSTOM preprocessor symbol define. The custom_board.h should contain a list of all the pins used for buttons and LEDS, just like they are in pca10040.h for nRF52832 DK as an example.

    Have you tried debugging to see what the error code is?

    EDIT 23.08.17

    To run the code with your custom_board.h I added the following lines to the definition of app_buttons[BUTTONS_NUMBER] in bsp.c

    #ifdef BSP_BUTTON_8
    {BSP_BUTTON_8, false, BUTTON_PULL, bsp_button_event_handler},
    #endif // BUTTON_8
    #ifdef BSP_BUTTON_9
    {BSP_BUTTON_9, false, BUTTON_PULL, bsp_button_event_handler},
    #endif // BUTTON_9
    #ifdef BSP_BUTTON_10
    {BSP_BUTTON_10, false, BUTTON_PULL, bsp_button_event_handler},
    #endif // BUTTON_10
    #ifdef BSP_BUTTON_11
    {BSP_BUTTON_11, false, BUTTON_PULL, bsp_button_event_handler},
    #endif // BUTTON_11
    #ifdef BSP_BUTTON_12
    {BSP_BUTTON_12, false, BUTTON_PULL, bsp_button_event_handler},
    #endif // BUTTON_12
    

    In sdk_config.h I changed

    #ifndef GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS
    #define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 4
    #endif
    

    to

    #ifndef GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS
    #define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 13
    #endif
    

    And in the preprocessor symbol defines I added BOARD_CUSTOM and removed BOARD_PCA10040

    GPIOTE for the nRF52832 has 8 channels, however these are only used for high accuracy mode. The bsp module however initializes these buttons as low accuracy mode (gpiote low power) (PORT event). You can have more than 8 buttons in low accuracy, but you cannot detect simultaneous button presses.

    Best regards

    Jørn Frøysa

  • As it turns out you will indeed need to modify the app_buttons array in bsp.c, I apologize for this blunder on my part. I overlooked the fact that it lists defines for each individual button within the array, and I see now it is only designed to handle 8 buttons. By adding defines for the rest of the buttons similar to what is done for the first 8 buttons, and setting the number of GPIOTE low power events in sdk_config.h to 13 you should be able to run the program.

Reply
  • As it turns out you will indeed need to modify the app_buttons array in bsp.c, I apologize for this blunder on my part. I overlooked the fact that it lists defines for each individual button within the array, and I see now it is only designed to handle 8 buttons. By adding defines for the rest of the buttons similar to what is done for the first 8 buttons, and setting the number of GPIOTE low power events in sdk_config.h to 13 you should be able to run the program.

Children
No Data
Related