Interrupt Callback nRF52805 ble_app_beacon

I working with the MDBT42Q-DB with the nRF52805 module.  I've started from the ble_app_beacon example in SDK 17.1.0.   I was able to compile and run the example in Segger Studio.  I wasn't able to get things to work with Keil.

I'm trying to modify the example to added button response for my onboard buttons.  Ultimately I'd like a button (input) to trigger a wake-up for several minutes (setting a timer) before allowing the beacon to go back into deep sleep.

I modified the pca10050.h to match the pin configuration of the development board:

#define LEDS_INV_MASK  LEDS_MASK

#define LEDS_LIST { LED_1, LED_2 }

#define BSP_LED_0      LED_1
#define BSP_LED_1      LED_2

#define BUTTONS_NUMBER 4

#define BUTTON_1       12
#define BUTTON_2       11
#define BUTTON_3       9
#define BUTTON_4       13
#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP

#define BUTTONS_ACTIVE_STATE 0

#define BUTTONS_LIST { BUTTON_1, BUTTON_2, BUTTON_3, BUTTON_4 }

#define BSP_BUTTON_0   BUTTON_1
#define BSP_BUTTON_1   BUTTON_2
#define BSP_BUTTON_2   BUTTON_3
#define BSP_BUTTON_3   BUTTON_4

I added BSP_INIT_BUTTONS and a callback handler for button presses in the leds_init fucntion

void bsp_event_handler(bsp_event_t event)
{
    printf("Event");
    switch(event)
    {
        case BSP_EVENT_KEY_0:
        case BSP_EVENT_KEY_1:
        case BSP_EVENT_KEY_2:
        case BSP_EVENT_KEY_3:
            printf("Event");
            break;
        default:
            break;
    }
}


/**@brief Function for initializing LEDs. */
static void btn_leds_init(void)
{
    ret_code_t err_code = bsp_init( BSP_INIT_LEDS | BSP_INIT_BUTTONS, bsp_event_handler);
    APP_ERROR_CHECK(err_code);
}

/**
 * @brief Function for application main entry.
 */
int main(void)
{
    bsp_event_t startup_event;

    log_init();
    timers_init();
    btn_leds_init();

    power_management_init();
    ble_stack_init();
    advertising_init();

    // Start execution.
    NRF_LOG_INFO("Beacon example started.");
    advertising_start();


    // Enter main loop.
    for (;; )
    {
        idle_state_handle();
    }
}

I've enable logging which suggests everything got initialized properly.  The ble_beacon is advertising the custom UUID i've set at the interval I've set both of which I can modify.

<info> PRS: Function: nrfx_prs_acquire, error code: NRF_SUCCESS.
<info> app_timer: RTC: initialized.
<info> GPIOTE: Function: nrfx_gpiote_init, error code: NRF_SUCCESS.
<info> GPIOTE: Function: nrfx_gpiote_in_init, error code: NRF_SUCCESS.
<info> GPIOTE: Function: nrfx_gpiote_in_init, error code: NRF_SUCCESS.
<info> GPIOTE: Function: nrfx_gpiote_in_init, error code: NRF_SUCCESS.
<info> GPIOTE: Function: nrfx_gpiote_in_init, error code: NRF_SUCCESS.
<info> CLOCK: Function: nrfx_clock_init, error code: NRF_SUCCESS.
<info> clock: Function: nrf_drv_clock_init, error code: NRF_SUCCESS.
<info> app: Beacon example started.

I confirmed that the pull-up on SW3 (only default connected switch to pin 9) is being configured with a pull-up as expected.

The status LED is blinking as expected with the advertising indication so I at least modified the LED pins properly.

It's possible some of my configuration, porting the project from pca10040e to support the rNF52805 wasn't completely done properly.  I followed this guide as best I could, but as mentioned about I wasn't successful getting Keil to run, though it seemed to compile.  Segger studio is at least running with some working.

I was using this guide:

https://devzone.nordicsemi.com/guides/short-range-guides/b/getting-started/posts/developing-for-the-nrf52805-with-nrf5-sdk

I put the full project here:

https://github.com/soccerno16/ds

Can you perhaps provide some direction?  I cannot seem to get any sort of interrupt response from the board.

Parents Reply Children
  • Sure in the pca10040e project natively supporting nRF5210 but modified to simulate nRF5205

    APP_TIMER_V2
    APP_TIMER_V2_RTC1_ENABLED
    BOARD_CUSTOM
    CONFIG_GPIO_AS_PINRESET
    FLOAT_ABI_SOFT
    INITIALIZE_USER_SECTIONS
    NO_VTOR_CONFIG
    NRF52805_XXAA
    NRF52_PAN_74
    NRF_SD_BLE_API_VERSION=7
    S112
    SOFTDEVICE_PRESENT

    Sure in the pca10040 project natively supporting nRF5232 

    APP_TIMER_V2
    APP_TIMER_V2_RTC1_ENABLED
    BOARD_PCA10040
    CONFIG_GPIO_AS_PINRESET
    FLOAT_ABI_HARD
    INITIALIZE_USER_SECTIONS
    NO_VTOR_CONFIG
    NRF52
    NRF52832_XXAA
    NRF52_PAN_74
    NRF_SD_BLE_API_VERSION=7
    S132
    SOFTDEVICE_PRESENT

  • Hmm, seems like you're missing CONFIG_NFCT_PINS_AS_GPIOS. That flag has to be set in the preprocessor list for the P0.09 and P0.10 to be available for the CPU, as they are by default assigned as NFC pins.

Related