52832 PA /LNA GPIOTE

static void nordic_pa_lna_assist(uint32_t gpio_pa_pin, uint32_t gpio_lna_pin)
{
ret_code_t err_code;

static const uint32_t gpio_toggle_ch = 0;
static const uint32_t ppi_set_ch = 0;
static const uint32_t ppi_clr_ch = 1;

// Configure SoftDevice PA/LNA assist
ble_opt_t opt;
memset(&opt, 0, sizeof(ble_opt_t));
// Common PA/LNA config
opt.common_opt.pa_lna.gpiote_ch_id = gpio_toggle_ch; // GPIOTE channel
opt.common_opt.pa_lna.ppi_ch_id_clr = ppi_clr_ch; // PPI channel for pin clearing
opt.common_opt.pa_lna.ppi_ch_id_set = ppi_set_ch; // PPI channel for pin setting
// PA config
opt.common_opt.pa_lna.pa_cfg.active_high = 1; // Set the pin to be active high
opt.common_opt.pa_lna.pa_cfg.enable = 1; // Enable toggling
opt.common_opt.pa_lna.pa_cfg.gpio_pin = gpio_pa_pin; // The GPIO pin to toggle

// LNA config
opt.common_opt.pa_lna.lna_cfg.active_high = 1; // Set the pin to be active high
opt.common_opt.pa_lna.lna_cfg.enable = 1; // Enable toggling
opt.common_opt.pa_lna.lna_cfg.gpio_pin = gpio_lna_pin; // The GPIO pin to toggle

err_code = sd_ble_opt_set(BLE_COMMON_OPT_PA_LNA, &opt);
APP_ERROR_CHECK(err_code);
}

When I call this function,My interrupt will not respond。

Here is my interrupt configuration

void WAKEUP_interrupts_init(void)
{
ret_code_t err_code;

if (!nrf_drv_gpiote_is_init())
{
err_code = nrf_drv_gpiote_init();
APP_ERROR_CHECK(err_code);
}

nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);
in_config.pull = NRF_GPIO_PIN_NOPULL;

err_code = nrf_drv_gpiote_in_init(BT_WAKE_UP_IRQn_PIN_NUMBER, &in_config, deca_irq_handler);
APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_event_enable(BT_WAKE_UP_IRQn_PIN_NUMBER, true);

}

Parents
  • Hi,

    I assume you got this code snippet from this old blog post. It demonstrates the basics, but it is up to you to pick an available GPIOTE channel and two available PPI channels. As you get an issue with GPIOTE after including this, you are using overlapping GPIOTE channels. The GPIOTE driver will automatically pick channels from 0, so I suggest using the last GPIOTE channel, by setting gpio_toggle_ch to 7 (instead of 0).

    If you also have problems with PPI you can pick different channels there. If you use the PPI driver to allocate PPI channels in your application (directly or via SDK libraries), you can use that to allcoate free channels fro this porpose as well using nrf_drv_ppi_channel_alloc().

Reply
  • Hi,

    I assume you got this code snippet from this old blog post. It demonstrates the basics, but it is up to you to pick an available GPIOTE channel and two available PPI channels. As you get an issue with GPIOTE after including this, you are using overlapping GPIOTE channels. The GPIOTE driver will automatically pick channels from 0, so I suggest using the last GPIOTE channel, by setting gpio_toggle_ch to 7 (instead of 0).

    If you also have problems with PPI you can pick different channels there. If you use the PPI driver to allocate PPI channels in your application (directly or via SDK libraries), you can use that to allcoate free channels fro this porpose as well using nrf_drv_ppi_channel_alloc().

Children
Related