Bluetooth Mesh TX power on nRF52

jpreston gravatar image

asked 2017-09-21 19:25:32 +0100

I'm playing around with the light and switch examples with the Bluetooth mesh SDK on nRF52832 devices. I'm trying to find out what the maximum distance would be given changes in TX output power. However, every time I make a call to the sd_ble_gap_tx_power_set function it returns an error.

I'm guessing this has something to do with the mesh SDK? Does the mesh SDK support changes in TX power?

edit retag flag offensive close delete report spam


I believe the accepted argument values for sd_ble_gap_tx_power_set() are -40, -20, -16, -12, -8, -4, 0, 4 (dbm). Please verify with the softdevice documentation.

Matt ( 2017-09-21 22:24:32 +0100 )editconvert to answer

I believe you are correct. I was using 4 as my value. See the answer below for the solution to the problem.

jpreston ( 2017-09-22 17:36:16 +0100 )editconvert to answer

1 answer

Sort by » oldest newest most voted
thomas.stenersen gravatar image

answered 2017-09-21 19:58:41 +0100

updated 2017-11-14 14:02:23 +0100

Hi jpreston,

The mesh stack operates within a SoftDevice timeslot and implements its own advertiser and scanner. To modify the TX output power of the device, I believe you only have to call the void radio_tx_power_set(radio_tx_power_t tx_power) function in mesh/include/core/radio.h. You could also set the default at compile time in mesh/src/core/radio.c in radio_init().

Edit for v0.10.0+

In the v0.10.0 a new bearer layer appeared and changed this around a bit. There is a concept of an "advertiser instance": advertiser_t in mesh/bearer/include/advertiser.h. This means that the stack can instantiate and use any number of advertisers concurrently. Each advertiser owns a broadcast_t structure, which owns the lower level radio configurations like which access address, what advertising channels and what radio_config_t to use.

To answer your question directly. To change the TX power of the mesh itself, you would really have to change the values used in the individual advertiser_t instances. However, all advertisers used in the mesh are set up with default parameters by the set_default_broadcast_configuration() in advertiser.c:268. In that function you can change the default TX power among other things.


edit flag offensive delete publish link more


Thanks, Thomas! That helps me a lot after getting a lot of search results for the function I was trying to use instead...

jpreston ( 2017-09-21 20:04:44 +0100 )editconvert to answer

I'm glad to hear that!

Thomas Stenersen ( 2017-09-21 20:18:54 +0100 )editconvert to answer

Hi, looks it's changed in v0.10 version. I cannot find "radio_tx_power_set"

aaronxu ( 2017-11-10 04:32:03 +0100 )editconvert to answer

overheat (aaronxu): I think that you should be able to use radio_config_config() to set the tx power by passing it a radio_config_t struct

Bjørn Spockeli ( 2017-11-14 13:44:57 +0100 )editconvert to answer

Updated my answer with information for v0.10.0+ :)

Thomas Stenersen ( 2017-11-14 14:02:47 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

Question Tools

1 follower


Asked: 2017-09-21 19:25:32 +0100

Seen: 230 times

Last updated: nov. 14 '17