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

  • Hello Jørn,

    Yes am using nRF52832 soc,

    what i modified In bsp.c file is that , app_buttons[] configuration array definition, i added BSP_BUTTON_8 to BSP_BUTTON_12. Initially it was defined upto BSP_BUTTON_7. I did this with the intention of registering the additional 5 buttons used by the application. However, from your answer i understood that this is wrong. And it seems i am having the problem for this reason due to the limitation of GPIOTE.

    But i still didn’t find material to follow to setup the bsp for 13 buttons and receive button press even. As u pointed out i already did custom header (which i will past below for your reference), and the BOARD_CUSTOM macro. But clearly there must be something more i should do because the program crash if i just do this. U can try this for yourself easily. i am using SDK 14, HID keyboard example, nRF52-DK (yes i tried it on the DK also, in addition to the custom board),

    The error code, id = 0x4001, pc = 0x0, info = 0x200057C8

    This is from the app_error_fault_handler in app_error_weak.c file

Reply
  • Hello Jørn,

    Yes am using nRF52832 soc,

    what i modified In bsp.c file is that , app_buttons[] configuration array definition, i added BSP_BUTTON_8 to BSP_BUTTON_12. Initially it was defined upto BSP_BUTTON_7. I did this with the intention of registering the additional 5 buttons used by the application. However, from your answer i understood that this is wrong. And it seems i am having the problem for this reason due to the limitation of GPIOTE.

    But i still didn’t find material to follow to setup the bsp for 13 buttons and receive button press even. As u pointed out i already did custom header (which i will past below for your reference), and the BOARD_CUSTOM macro. But clearly there must be something more i should do because the program crash if i just do this. U can try this for yourself easily. i am using SDK 14, HID keyboard example, nRF52-DK (yes i tried it on the DK also, in addition to the custom board),

    The error code, id = 0x4001, pc = 0x0, info = 0x200057C8

    This is from the app_error_fault_handler in app_error_weak.c file

Children
No Data
Related