0

I have some trouble to control GPIOTE function with nRF52832 sdk, when using 14.01 version(SDK), it seems that the GPIOTE function can't be used with BLE function, I used the code below, it made hang-up issue of system, why?

I wonder whether GPIOTE function can't be used with BLE function or not, and another method to use the function with BLE function, thankful for your support and kindness in advance,

#define PIN_IN  BUTTON_4
//#define PIN_OUT BSP_LED_3

void in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
    printf("love %d: %d\n", (int)pin, (int)action); 
//  nrf_drv_gpiote_out_toggle(PIN_OUT);
}

/**
 * @brief Function for configuring: PIN_IN pin for input, PIN_OUT pin for output,
 * and configures GPIOTE to give an interrupt on pin change.
 */

void gpio_external_int_init(void)//love_1108
{
    uint32_t  err_code;

    err_code = nrf_drv_ppi_init();
    APP_ERROR_CHECK(err_code);  
//  
    err_code = nrf_drv_gpiote_init();
    APP_ERROR_CHECK(err_code);
//
//  (void)nrf_drv_gpiote_init();    

//  nrf_drv_gpiote_out_config_t out_config = GPIOTE_CONFIG_OUT_SIMPLE(false);
//  err_code = nrf_drv_gpiote_out_init(PIN_OUT, &out_config);
//  APP_ERROR_CHECK(err_code);

    nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
    in_config.pull = NRF_GPIO_PIN_PULLUP;
    err_code = nrf_drv_gpiote_in_init(PIN_IN, &in_config, in_pin_handler);
    APP_ERROR_CHECK(err_code);

    nrf_drv_gpiote_in_event_enable(PIN_IN, true);
}

1 Answers1

0

While you don't provide much detail, such as what is meant by "used with BLE function", I have found an issue with the SDK example ble_app_template. In my case the cause was that the file bsp_btn_ble.c demands that there are more buttons than my board_custom.h defines. So the function startup_event_extract() wants to check the state of BTN_ID_WAKEUP_BOND_DELETE, which does not exist on my hardware, causes an assertion. It is disturbing that BTN_ID_WAKEUP_BOND_DELETE and other buttons are defined in the c file, rather than being derived from custom_board.h. So, trace the board initialization and you may find something like ASSERT(button_idx < BUTTONS_NUMBER), which caused a hang in my case.

Sudheesh Singanamalla
  • 2,283
  • 3
  • 19
  • 36