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

  • Hey Jørn,

    Am having the issue on the SDK ble HID keyboard example. i have attached the header file to the original question. just use the header, on SDK 14 HID keyboard example. and you will see that the program stuck when bsp is initialized. However, if u set the number of buttons less than 8 the program works fine. also if u modify bsp.c as i mentioned previously (though it is completely wrong) and set GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS to 13., then the program runs for sometime but it will also throw the error (id = 0x4001, pc = 0x0, info = 0x20005760)

    So my question is how to use the board support package for 13 buttons or more and receive push events. The titorial mentions to configure GPIOTE handler (as i understood from you this is limited to 8 channels).

Reply
  • Hey Jørn,

    Am having the issue on the SDK ble HID keyboard example. i have attached the header file to the original question. just use the header, on SDK 14 HID keyboard example. and you will see that the program stuck when bsp is initialized. However, if u set the number of buttons less than 8 the program works fine. also if u modify bsp.c as i mentioned previously (though it is completely wrong) and set GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS to 13., then the program runs for sometime but it will also throw the error (id = 0x4001, pc = 0x0, info = 0x20005760)

    So my question is how to use the board support package for 13 buttons or more and receive push events. The titorial mentions to configure GPIOTE handler (as i understood from you this is limited to 8 channels).

Children
No Data
Related