Compilation Error when Configuring NRF21540 on NRF5340

I've been using ICMSG's IPC to exchange HCI messages between the netcore and appcore, and using SPI to exchange HCI information between the host and appcore. This setup enables HCI message transfer between the netcore and the host, and it works properly.

However, when I configure the NRF21540 FEM in the netcore, I get an error indicating that mpsl_work_q is undefined in hci_driver.c. I traced the code and found that mpsl_work_q is defined in mpsl_init.c, and it requires CONFIG_MPSL_FEM_ONLY=n. But when CONFIG_FEM=y is set, it automatically selects MPSL_FEM_ONLY.

So it seems like there's a conflict between my HCI and FEM configurations. How can I configure it to ensure both FEM and HCI are enabled at the same time?

Parents
  • Hi kpi_xie,

    What application are you having on the netcore? A regular BLE controller, or something custom of your own?

    What version of the SDK are you using?

    Hieu

  • my sdk is ncs 2.6.1

    The netcore has a simple program whose function is to send messages from the BLE rx_queue to the appcore via ICMSG IPC, and forward the messages received through IPC to the Bluetooth module via bt_send. The program is based on the hci_spi implementation but replaces SPI with IPC.

    Below are the configuration items related to FEM and HCI in my prj.conf.

    CONFIG_BT=y
    CONFIG_BT_HCI_RAW=y
    CONFIG_BT_MAX_CONN=8
    CONFIG_BT_TINYCRYPT_ECC=n
    CONFIG_BT_HCI_RAW_RESERVE=1
    CONFIG_FEM=y
    CONFIG_FEM_AL_LIB=y
    CONFIG_MPSL_FEM=y

    CONFIG_SPI=y
    CONFIG_SPI_NRFX=y
    CONFIG_NRFX_SPIM0=y

    # CONFIG_MPSL_FEM_ONLY=y
    CONFIG_MPSL_FEM_NRF21540_GPIO=y
    # CONFIG_MPSL_FEM_NRF21540_GPIO_SPI=y
    CONFIG_MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL=y
    CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA=7
    CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTB=7
    CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB=7
    CONFIG_MPSL_FEM_NRF21540_RX_GAIN_DB=13
    The configuration related to FEM in the DTS overlay file of netcore.
    &spi0 {
        status = "okay";
        cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;

        pinctrl-0 = <&spi0_default>;
        pinctrl-1 = <&spi0_sleep>;
        pinctrl-names = "default", "sleep";

        nrf_radio_fem_spi: nrf21540_fem_spi@0 {
            compatible = "nordic,nrf21540-fem-spi";
            reg = <0>;
            spi-max-frequency = <8000000>;

            status = "okay";
        };
    };

    &radio{
        /delete-property/ ieee802154-supported;

        fem = <&nrf_radio_fem>;
    };
    / {
         nrf_radio_fem: nrf21540_fem {
            compatible = "nordic,nrf21540-fem";
            tx-en-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
            rx-en-gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>;
            pdn-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
            ant-sel-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
            mode-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
            spi-if = <&nrf_radio_fem_spi>;
            supply-voltage-mv = <3000>;

            status = "okay";
        };
    }
Reply
  • my sdk is ncs 2.6.1

    The netcore has a simple program whose function is to send messages from the BLE rx_queue to the appcore via ICMSG IPC, and forward the messages received through IPC to the Bluetooth module via bt_send. The program is based on the hci_spi implementation but replaces SPI with IPC.

    Below are the configuration items related to FEM and HCI in my prj.conf.

    CONFIG_BT=y
    CONFIG_BT_HCI_RAW=y
    CONFIG_BT_MAX_CONN=8
    CONFIG_BT_TINYCRYPT_ECC=n
    CONFIG_BT_HCI_RAW_RESERVE=1
    CONFIG_FEM=y
    CONFIG_FEM_AL_LIB=y
    CONFIG_MPSL_FEM=y

    CONFIG_SPI=y
    CONFIG_SPI_NRFX=y
    CONFIG_NRFX_SPIM0=y

    # CONFIG_MPSL_FEM_ONLY=y
    CONFIG_MPSL_FEM_NRF21540_GPIO=y
    # CONFIG_MPSL_FEM_NRF21540_GPIO_SPI=y
    CONFIG_MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL=y
    CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA=7
    CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTB=7
    CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB=7
    CONFIG_MPSL_FEM_NRF21540_RX_GAIN_DB=13
    The configuration related to FEM in the DTS overlay file of netcore.
    &spi0 {
        status = "okay";
        cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;

        pinctrl-0 = <&spi0_default>;
        pinctrl-1 = <&spi0_sleep>;
        pinctrl-names = "default", "sleep";

        nrf_radio_fem_spi: nrf21540_fem_spi@0 {
            compatible = "nordic,nrf21540-fem-spi";
            reg = <0>;
            spi-max-frequency = <8000000>;

            status = "okay";
        };
    };

    &radio{
        /delete-property/ ieee802154-supported;

        fem = <&nrf_radio_fem>;
    };
    / {
         nrf_radio_fem: nrf21540_fem {
            compatible = "nordic,nrf21540-fem";
            tx-en-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
            rx-en-gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>;
            pdn-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
            ant-sel-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
            mode-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
            spi-if = <&nrf_radio_fem_spi>;
            supply-voltage-mv = <3000>;

            status = "okay";
        };
    }
Children
Related