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

Parents Reply Children
  • Hello,

    It looks like multiprotocol FEM support is not supported at the moment. It may be that it works, but it is not tested from our side. That being said, the 802.15.4 drivers needs to be re-built to change the default support from the nRF21540 to the Skyworks module.

    It doesn't look like this is something you can do yourself, but let me double check that.

    If we can rebuild these drivers, it still isn't a guarantee that the multiprotocol will work with the skyworks module.

    Best regards,

    Edvin

  • Hello,

    So I spoke some more with our Zigbee team regarding rebuilding the radio drivers. It is possible to do, and you can do it by modifying the generated drivers.

    I have only received this file for the SDK4.1.0. I don't think there are too many API changes between 4.0.0 and 4.1.0. Can you please try to port to SDK4.1.0?

    The modified drivers are attached here:

    0312.nrf_radio_driver.a

    7268.nrf_radio_driver_simulator.a

    5125.nrf_radio_driver_softdevice.a

    What you need to do is to replace these (the one that you use), and then change the application's header files to match these.

    The change was that nrf-802154-driver/src/fem/three_pin_gpio/nrf_fem_three_pin_gpio.c was removed, and 

    nrf-802154-driver/src/fem/simple_gpio/nrf_fem_simple_gpio.c was added, and the include folder:

    nrf-802154-driver/src/fem/three_pin_gpio was removed, and nrf-802154-driver/src/fem/simple_gpio was included.

    In case you want to build these yourself, you can use this makefile, which you place in the root folder of the radio driver root folder (use v1.6.1)

    #-*-Makefile-*-
    #/* ZBOSS Zigbee 3.0
    # *
    # * Copyright (c) 2012-2018 DSR Corporation, Denver CO, USA.
    # * http://www.dsr-zboss.com
    # * http://www.dsr-corporation.com
    # * All rights reserved.
    # *
    # *
    # * Use in source and binary forms, redistribution in binary form only, with
    # * or without modification, are permitted provided that the following conditions
    # * are met:
    # *
    # * 1. Redistributions in binary form, except as embedded into a Nordic
    # *    Semiconductor ASA integrated circuit in a product or a software update for
    # *    such product, must reproduce the above copyright notice, this list of
    # *    conditions and the following disclaimer in the documentation and/or other
    # *    materials provided with the distribution.
    # *
    # * 2. Neither the name of Nordic Semiconductor ASA nor the names of its
    # *    contributors may be used to endorse or promote products derived from this
    # *    software without specific prior written permission.
    # *
    # * 3. This software, with or without modification, must only be used with a Nordic
    # *    Semiconductor ASA integrated circuit.
    # *
    # * 4. Any software provided in binary form under this license must not be reverse
    # *    engineered, decompiled, modified and/or disassembled.
    # *
    # * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS OR
    # * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    # * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
    # * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE LIABLE
    # * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    # * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    # * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
    # * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    # * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    #  PURPOSE: Makefile for Nordic nRF52840 driver
    # */
    
    BUILD_HOME := ..
    
    ifeq ($(ZB_GNU_INSTALL_ROOT),)
    # Linux
    #  ZB_GNU_INSTALL_ROOT := /usr/local/gcc-arm-none-eabi-6-2017-q2-update/bin
    # Windows
     ZB_GNU_INSTALL_ROOT := C:/Program Files (x86)/GNU Tools ARM Embedded/4.9 2015q3/bin
    endif
    
    # Nordic SDK and Driver
    ifeq ($(ZB_NSDK_ROOT),)
      ZB_NSDK_ROOT := $(BUILD_HOME)/../4.1.0
    endif
    ifeq ($(ZB_NDRV_ROOT),)
      ZB_NDRV_ROOT := $(BUILD_HOME)/nRF-IEEE-802.15.4-radio-driver-1.6.1
    endif
    
    CC      := "$(ZB_GNU_INSTALL_ROOT)/arm-none-eabi-gcc"
    AR      := "$(ZB_GNU_INSTALL_ROOT)/arm-none-eabi-ar"
    
    # Source files common to all targets
    SRC_FILES += \
      $(ZB_NDRV_ROOT)/src/nrf_802154.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_critical_section.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_debug.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_core.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_core_hooks.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_pib.c \
      $(ZB_NDRV_ROOT)/src/rsch/nrf_802154_rsch.c \
      $(ZB_NDRV_ROOT)/src/rsch/nrf_802154_rsch_crit_sect.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_rssi.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_rx_buffer.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_timer_coord.c \
      $(ZB_NDRV_ROOT)/src/fal/nrf_802154_fal.c \
      $(ZB_NDRV_ROOT)/src/fem/simple_gpio/nrf_fem_simple_gpio.c \
    #  $(ZB_NDRV_ROOT)/src/fem/three_pin_gpio/nrf_fem_three_pin_gpio.c \
      $(ZB_NDRV_ROOT)/src/mac_features/nrf_802154_csma_ca.c \
      $(ZB_NDRV_ROOT)/src/mac_features/nrf_802154_filter.c \
      $(ZB_NDRV_ROOT)/src/mac_features/nrf_802154_delayed_trx.c \
      $(ZB_NDRV_ROOT)/src/mac_features/nrf_802154_frame_parser.c \
      $(ZB_NDRV_ROOT)/src/mac_features/nrf_802154_precise_ack_timeout.c \
      $(ZB_NDRV_ROOT)/src/mac_features/ack_generator/nrf_802154_ack_data.c \
      $(ZB_NDRV_ROOT)/src/mac_features/ack_generator/nrf_802154_ack_generator.c \
      $(ZB_NDRV_ROOT)/src/mac_features/ack_generator/nrf_802154_enh_ack_generator.c \
      $(ZB_NDRV_ROOT)/src/mac_features/ack_generator/nrf_802154_imm_ack_generator.c \
      $(ZB_NDRV_ROOT)/src/platform/clock/nrf_802154_clock_sdk.c \
      $(ZB_NDRV_ROOT)/src/platform/lp_timer/nrf_802154_lp_timer_nodrv.c \
      $(ZB_NDRV_ROOT)/src/platform/hp_timer/nrf_802154_hp_timer.c \
      $(ZB_NDRV_ROOT)/src/platform/random/nrf_802154_random_stdlib.c \
      $(ZB_NDRV_ROOT)/src/platform/temperature/nrf_802154_temperature_none.c \
      $(ZB_NDRV_ROOT)/src/platform/coex/nrf_802154_wifi_coex_none.c \
      $(ZB_NDRV_ROOT)/src/timer_scheduler/nrf_802154_timer_sched.c  \
    
    SRC_FILES_NOSD = \
      $(SRC_FILES) \
      $(ZB_NDRV_ROOT)/src/rsch/raal/single_phy/single_phy.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_notification_direct.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_priority_drop_direct.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_request_direct.c \
    
    SRC_FILES_SD = \
      $(SRC_FILES) \
      $(ZB_NDRV_ROOT)/src/rsch/raal/softdevice/nrf_raal_softdevice.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_notification_swi.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_priority_drop_swi.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_request_swi.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_swi.c \
    
    SRC_FILES_SIMULATOR = \
      $(SRC_FILES) \
      $(ZB_NDRV_ROOT)/src/rsch/raal/simulator/nrf_raal_simulator.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_notification_direct.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_priority_drop_direct.c \
      $(ZB_NDRV_ROOT)/src/nrf_802154_request_direct.c \
    
    # Include folders common to all targets
    
    
    INC_FOLDERS += \
      -I$(ZB_NDRV_ROOT)/src \
      -I$(ZB_NDRV_ROOT)/src/fal \
      -I$(ZB_NDRV_ROOT)/src/fem \
      -I$(ZB_NDRV_ROOT)/src/fem/simple_gpio \
    #  -I$(ZB_NDRV_ROOT)/src/fem/three_pin_gpio \
      -I$(ZB_NDRV_ROOT)/src/rsch/raal \
      -I$(ZB_NDRV_ROOT)/src/rsch \
      -I$(ZB_NDRV_ROOT)/src/platform/clock \
      -I$(ZB_NDRV_ROOT)/src/platform/lp_timer \
      -I$(ZB_NDRV_ROOT)/src/platform/hp_timer \
      -I$(ZB_NDRV_ROOT)/src/platform/random \
      -I$(ZB_NDRV_ROOT)/src/platform/temperature \
      -I$(ZB_NDRV_ROOT)/src/platform/coex \
      -I$(ZB_NDRV_ROOT)/src/mac_features \
      -I$(ZB_NDRV_ROOT)/src/mac_features/ack_generator \
      -I$(ZB_NDRV_ROOT)/src/timer_scheduler \
      -I$(ZB_NSDK_ROOT)/config/nrf52840/config \
      -I$(ZB_NSDK_ROOT)/components/libraries/util \
      -I$(ZB_NSDK_ROOT)/components/toolchain/cmsis/include \
      -I$(ZB_NSDK_ROOT)/modules/nrfx/mdk \
      -I$(ZB_NSDK_ROOT)/modules/nrfx/drivers/include \
      -I$(ZB_NSDK_ROOT)/modules/nrfx/hal \
      -I$(ZB_NSDK_ROOT)/modules/nrfx \
      -I$(ZB_NSDK_ROOT)/integration/nrfx \
      -I$(ZB_NSDK_ROOT)/integration/nrfx/legacy \
      -I$(ZB_NSDK_ROOT)/components/libraries/util \
      -I$(ZB_NSDK_ROOT)/config/nrf52840/config \
    
    INC_FOLDERS_NOSD = \
      -I$(ZB_NSDK_ROOT)/config/nrf52840/config \
      $(INC_FOLDERS) \
      -I$(ZB_NSDK_ROOT)/components/drivers_nrf/nrf_soc_nosd \
    
    INC_FOLDERS_SD = \
      $(INC_FOLDERS) \
      -I$(ZB_NDRV_ROOT)/src/rsch/raal/softdevice \
      -I$(ZB_NSDK_ROOT)/components/softdevice/common \
      -I$(ZB_NSDK_ROOT)/components/softdevice/s140/headers \
      -I$(ZB_NSDK_ROOT)/components/softdevice/s140/headers/nrf52 \
    
    INC_FOLDERS_SIMULATOR = \
      $(INC_FOLDERS) \
      -I$(ZB_NSDK_ROOT)/src/rsch/raal/simulator \
      -I$(ZB_NSDK_ROOT)/components/drivers_nrf/nrf_soc_nosd \
    
    
    # Optimization flags
    OPT = -Os # -g3
    # Uncomment the line below to enable link time optimization
    #OPT += -flto
    
    DEFINES += -DDEBUG_NRF
    DEFINES += -DBOARD_PCA10056
    DEFINES += -DNRF52840_XXAA
    DEFINES += -DENABLE_FEM
    
    DEFINES_NOSD = $(DEFINES) -DRAAL_SINGLE_PHY
    DEFINES_SD = $(DEFINES) -DS140 -DRAAL_SOFTDEVICE -DSOFTDEVICE_PRESENT #-DSWI_DISABLE0
    DEFINES_SIMULATOR = $(DEFINES) -DRAAL_SIMULATOR
    
    # C flags common to all targets
    CFLAGS += $(OPT) 
    CFLAGS += -mcpu=cortex-m4
    CFLAGS += -mthumb -mabi=aapcs
    CFLAGS +=  -Wall -Werror
    CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
    # keep every function in a separate section, this allows linker to discard unused ones
    CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
    CFLAGS += -fno-builtin -fshort-enums
    CFLAGS += -std=c99
    
    DRV_LIB_NOSD = nrf_radio_driver.a
    DRV_LIB_SD = nrf_radio_driver_softdevice.a
    DRV_LIB_SIMULATOR = nrf_radio_driver_simulator.a
    
    .SUFFIXES: .c .o .nosd.o .sd.o  .sim.o
    
    .c.nosd.o:
    	$(CC)  -c $(CFLAGS) $(DEFINES_NOSD) $(INC_FOLDERS_NOSD) -o $@ $<
    .c.sd.o:
    	$(CC)  -c $(CFLAGS) $(DEFINES_SD) $(INC_FOLDERS_SD) -o $@ $<
    .c.sim.o:
    	$(CC)  -c $(CFLAGS) $(DEFINES_SIMULATOR) $(INC_FOLDERS_SIMULATOR) -o $@ $<
    
    
    OBJ_FILES_NOSD = ${SRC_FILES_NOSD:.c=.nosd.o}
    OBJ_FILES_SD = ${SRC_FILES_SD:.c=.sd.o}
    OBJ_FILES_SIMULATOR = ${SRC_FILES_SIMULATOR:.c=.sim.o}
    MAKE_LIB    = $(AR) r $@ $^
    
    all: $(ZB_NDRV_ROOT)/$(DRV_LIB_NOSD) $(ZB_NDRV_ROOT)/$(DRV_LIB_SD) $(ZB_NDRV_ROOT)/$(DRV_LIB_SIMULATOR)
    
    $(ZB_NDRV_ROOT)/$(DRV_LIB_NOSD) : $(OBJ_FILES_NOSD)
    	$(MAKE_LIB)
    $(ZB_NDRV_ROOT)/$(DRV_LIB_SD) : $(OBJ_FILES_SD)
    	$(MAKE_LIB)
    $(ZB_NDRV_ROOT)/$(DRV_LIB_SIMULATOR) : $(OBJ_FILES_SIMULATOR)
    	$(MAKE_LIB)
    
    
    clean:
    	$(RM) -rf $(ZB_NDRV_ROOT)/$(DRV_LIB_NOSD)
    	$(RM) -rf $(ZB_NDRV_ROOT)/$(DRV_LIB_SD)
    	$(RM) -rf $(ZB_NDRV_ROOT)/$(DRV_LIB_SIMULATOR)
    	find $(ZB_NDRV_ROOT) -type f -name '*.o' -exec rm {} \;
    

    The changes you need to do is that the ZB_NDRV_ROOT needs to point to the radio driver repository, and ZB_NSDK_ROOT points to your SDK for thread and zigbee v4.1.0.

    Best regards,

    Edvin

  • Thanks so much. We will try to update this.

  • Hi, we tried these and by modifying pa and lna time gap settings it started to send some messges. Anyway, Wireshark logs show that with the times selected there are multiple retransmissions from devices to coordinator (which has the PA/LNA module)

    is there any recommendation on these settings? 

    Thanks in advance

Related