How to configure hci_pwr_ctrl demo to support nrf21540dk

I want to test the nrf21540dk to compare range improvements over the nrf5340dk and nrf52840dk. I am using the hci_pwr_ctrl demo and want to adapt it for the nrf21540dk. I think I need to add an Extra KConfig Fragment to enable the FEM. I was reading this post which had:

CONFIG_MPSL_FEM=y
CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y
CONFIG_MPSL_FEM_NRF21540_RX_GAIN_DB=0
CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB=20

I already have CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y as it is part of the demo and I am setting the tx dynamically, so I don't think I need CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB=20. Is there anything else I need?

I believe I also need to change this array in main.c:

static const int8_t txpower[DEVICE_BEACON_TXPOWER_NUM] = {4, 0, -3, -8,-15, -18, -23, -30};

I think I can do this to determine the txpower based on the board:

#ifdef defined(CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP)
	static const int8_t txpower[DEVICE_BEACON_TXPOWER_NUM] = {3, 0, -3, -8,-15, -18, -23, -30};
#elif defined(CONFIG_BOARD_NRF21540DK_NRF52840)
	static const int8_t txpower[DEVICE_BEACON_TXPOWER_NUM] = {4, 0, -3, -8,-15, -18, -23, -30};
#else
	static const int8_t txpower[DEVICE_BEACON_TXPOWER_NUM] = {4, 0, -3, -8,-15, -18, -23, -30};
#endif

as I tried this in main.c:

	#ifdef CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP
		// Dual-core specific code for nRF5340 App Core
		LOG_DBG("Running on nRF5340 App Core (Host)");
	#elif defined(CONFIG_BOARD_NRF52840DK_NRF52840)
		// Single-core specific code for nRF52840
		LOG_DBG("Running on nRF52840 (Single Core)");
	#elif defined(CONFIG_BOARD_NRF21540DK_NRF52840)
		LOG_INF("Running on nRF21540 DK");
	#else
		// Default or unknown board
		LOG_DBG("Running on an unknown or unsupported board");
	#endif

and got this in the log:

[00:00:00.000,488] <inf> app: Running on nRF21540 DK


I would also like to see how to configure the rx as well and set it to the maximum. Are the above configuration settings right? What should my txpower array be for testing? Do I need to do anything to test and confirm the rx settings?

Parents Reply Children
No Data
Related