We are currently adding the nRF21540 to our nRF5340 based product to increase our communication range. More precisely: We are switching from Fanstel BT40 to BT40N. We have also migrated our software project to NCS v2.9.0 in the progress.
Currently, we can configure our system for +10 dBm or +20 dBm via Kconfig, we are setting the desired transmit power via CONFIG_BT_CTLR_TX_PWR_ANTENNA :
##### FEM Config ##### CONFIG_FEM=y CONFIG_MPSL=y CONFIG_MPSL_FEM=y CONFIG_MPSL_FEM_NRF21540_GPIO=y #CONFIG_MPSL_FEM_NRF21540_GPIO_SPI=n CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB=20 CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA=20 CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTB=10 ##### TX Power Config ##### CONFIG_BT_CTLR_TX_PWR_ANTENNA=20
As we do not want to create separate firmware versions for FCC and ETSI regions, we are looking for a way to configure the gain control via software, making it possible to configure the region (transmit power) via a parameter in NVM. It seems like CONFIG_MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL=y would be what we need, but I could not find any information about how to actively switch the transmit power in software. The nRF21540's driver documentation page doesn't specify any software API's to switch the configuration during runtime. What's worse, I fear that the power has to be controlled on the nRF5340's net core (which is running hci_ipc), and our current project is only running on the app core.
Is there an easy way to implement dynamic gain control from the nRF5340's app core? Some API like "SetBluetoothTxPower(int dbm)"? If so, do we need special Kconfig artefacts to enable this function on the app core?
According to my understanding, if we would simply use the nRF21540 without any Zephyr driver support, we could simply switch the MODE pin to switch between +10 dBm and +20 dBm. But it seems a bit tricky doing this in NCS and Zephyr...
Best regards,
Michael