This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PA + LNA with BLE and Zigbee at the same time

Hi,

We have been working with a coordinator and a router device based on nRF52840 with nRF5_SDK_for_Thread_and_Zigbee_v4.0.0_dc7186b

Both devices are Zigbee 3.0 and implement Install Codes.

On the Coordinator we have Zigbee and BLE turned on at the same time on a Fanstel BT840X with integrated PA/LNA

We tried several things:

1.When running this code, BLE seems to work but Zigbee does not seem to send Link Status messages among others

ret_code_t pa_lna_init(uint32_t gpio_pa_pin, uint32_t gpio_lna_pin)
{
    ble_opt_t opt;
    uint32_t gpiote_ch = NULL;
    ret_code_t err_code;        

    nrf_gpio_cfg_output(APP_CPS_PIN);
    nrf_gpio_cfg_output(APP_CHL_PIN);
    nrf_gpio_pin_set(APP_CHL_PIN);	
    nrf_gpio_pin_clear(APP_CPS_PIN); //enable
    //nrf_gpio_pin_set(APP_CPS_PIN); //bypass
    nrf_gpio_cfg_output(APP_PA_PIN);
    nrf_gpio_pin_clear(APP_PA_PIN); //
    nrf_gpio_cfg_output(APP_LNA_PIN);
    nrf_gpio_pin_clear(APP_LNA_PIN); //

    memset(&opt, 0, sizeof(ble_opt_t));
    
    if (!nrf_drv_gpiote_is_init())
    {
      err_code = nrf_drv_gpiote_init();
      if(err_code != NRF_ERROR_INVALID_STATE)
          APP_ERROR_CHECK(err_code);
    }
    
    err_code = nrf_drv_ppi_init();
    if(err_code != NRF_ERROR_MODULE_ALREADY_INITIALIZED)
        APP_ERROR_CHECK(err_code);
    
    nrf_ppi_channel_t ppi_set_ch;
    nrf_ppi_channel_t ppi_clr_ch;
    
    err_code = nrf_drv_ppi_channel_alloc(&ppi_set_ch);
    APP_ERROR_CHECK(err_code);
    
    err_code = nrf_drv_ppi_channel_alloc(&ppi_clr_ch);
    APP_ERROR_CHECK(err_code);

    nrf_drv_gpiote_out_config_t config = GPIOTE_CONFIG_OUT_TASK_TOGGLE(false);
    
    if((gpio_pa_pin == NULL) && (gpio_lna_pin == NULL))
    {
        err_code = NRF_ERROR_INVALID_PARAM;
        APP_ERROR_CHECK(err_code);
    }    

    if(gpio_pa_pin != NULL)
    {
        if(gpiote_ch == NULL)
        {
            // nrf_drv_gpiote_out_uninit(gpio_pa_pin);
            err_code = nrf_drv_gpiote_out_init(gpio_pa_pin, &config);
            APP_ERROR_CHECK(err_code);
            
            gpiote_ch = nrf_drv_gpiote_out_task_addr_get(gpio_pa_pin); 
        }
        
        // 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 tx  
    }
    
    if(gpio_lna_pin != NULL)
    {
        if(gpiote_ch == NULL)
        {
            // nrf_drv_gpiote_out_uninit(gpio_lna_pin);
            err_code = nrf_drv_gpiote_out_init(gpio_lna_pin, &config);
            APP_ERROR_CHECK(err_code);        
            
            gpiote_ch = nrf_drv_gpiote_out_task_addr_get(gpio_lna_pin); 
        }
        
        // 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 rx
    }

    // Common PA/LNA config
    opt.common_opt.pa_lna.gpiote_ch_id  = (gpiote_ch - NRF_GPIOTE_BASE) >> 2;   // GPIOTE channel used for radio pin toggling
    opt.common_opt.pa_lna.ppi_ch_id_clr = ppi_clr_ch;   // PPI channel used for radio pin clearing
    opt.common_opt.pa_lna.ppi_ch_id_set = ppi_set_ch;   // PPI channel used for radio pin setting
    
    err_code = sd_ble_opt_set(BLE_COMMON_OPT_PA_LNA, &opt);
    // APP_ERROR_CHECK(err_code);    

    return err_code;
}

2. When setting at sdk_config.h FEM_CONTROL_DEFAULT_ENABLE to 1 (and other FEM_CONTROL_DEFAULT_XXX for pins), BLE stops working...

So, we would like to know which is the right approach to get Zigbee and BLE working at the same time with PA/LNA

Regards,

Santiago

Related