Hello everyone,
I’m working on a project using two nRF5340-DK boards to measure throughput and RSSI while dynamically changing the PHY and TX power. I started from the official throughput example and added:
-
RSSI measurement (I think this works)
-
A shell command
config pwr <value in dBm>to adjust the transmit power, implemented similarly to the PHY-change command
The problem is that power adjustment only works at the default 0 dBm. If I try any other value, the command runs but returns an error, so it looks like my implementation isn’t actually applying the new power setting.
When I set the transmit power to anything other than 0 dBm, I get this output:

Here’s what I’ve changed (all code is available on GitHub):
-
cmds.c
-
Added a default TX power of 0 dBm
-
Registered the
config pwrsubcommand inSHELL_STATIC_SUBCMD_SET_CREATE -
Implemented the
pwr_cmdfunction to parse and store the dBm value
-
-
main.h / main.c
-
Declared
extern int8_t g_tx_power;inmain.hand defined it inmain.c -
Modified
connection_configuration_set()to applyg_tx_powerto the BLE connection
-
You can find the full code here:
https://github.com/diegonovo02/prueba_ble
Does anyone know why only 0 dBm works, and how I can get other power levels to apply correctly? Any pointers or fixes would be hugely appreciated!
Thanks in advance,
Diego