set tx power with tx power service on zephyr

hello Nordic

i am using nrf52840, with zephyr 

i wish to use the nrfConnect Tx power service to read and to SET my Tx power

but in ncs in zephyr/subsys/bluetooth/services/tps.c i see implementation only for "read_tx_power_level"

does it mean that the serice does not support set of the tx power or that the use of setting via the service is done somewhere else, if so can you direct me to where ?

hope to read from you soon

best regards

Ziv 

Parents
  • Hi,

    The Tx Power Service (TPS) is a Bluetooth defined service, you can find the specification on this page. If you look at chapter 3 of the specification, you can see that only Read property is mandatory, while other properties are marked ‘X’ (excluded/not permitted).

    If you want to set the TX power, you need to create a custom service for this.

    Best regards,
    Jørgen

  • Hi,

    ziv123 said:
    i saw there is an example in zephyr/samples/bluetooth/hci_pwr_ctrl , i wanted to make sure i understand it right then .. is it just for the nrf52840 peripheral side and it is actually not showing how to set the tx power from a central side, after connection has been established and the nrf52840 peripheral is configured to by it self try save on tx power via the analysing of the RSSI ?

    Yes, that is correct.

    ziv123 said:
    is it actually possible to change the tx power within an already established ble connection via some custom service

    Yes, you you create a custom service, you can change the TX power when the set TX power characteristics is written, just like the sample changes the power dynamically based on RSSI.

    ziv123 said:
    is there some service that already contain this feature?

    I'm not aware of any such service, but you can follow "nRF Connect SDK Bluetooth Low Energy tutorial part 1: Custom Service in Peripheral role" to create your own custom service in nRF Connect SDK.

    Best regards,
    Jørgen

  • hi Jorgen

    is this on research or something ?

    i have posted a replay more the 5 days ago, re-posted an edited the replay 3 days ago and no replay

    hope to read from you soon

    best regards

    Ziv 

  • Hi,

    0xFC0E is the opcode of BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL. As you can see from the HCI VS API, this is defined as ((0x000E) | ((0x3F) << 10)) = 0xFC0E. As far as I can see, status code 0x42 means BT_HCI_ERR_UNKNOWN_ADV_IDENTIFIER

    I tested you code and configs together with the peripheral_lbs example in NCS v1.8.0, and the TX power seems to be changed correctly with the latest addition (actually only "CONFIG_BT_LL_SW_SPLIT=y" is need in my test). Verified that the RSSI is significantly lower with TX output power set to -40 through set_tx_power().

    It looks like you are using an older version, can you try with NCS v1.8.0?

    Best regards,
    Jørgen

  • hi

    seems that moving to ncs 1.8 forces me to update to zephyr-sdk-0.13.2 (from 0.12.4) 

    is it really a must or am i missing something ?

    also, seems that when moving to the new zephyr sdk i have a problem with the dfu (based on the smp service), i use the nrfConnect for the dfu and it seems like its done ok but then after reset the version remains the old version. any ideas on why is that, maybe i need to change some configs ? 

    do i also need to update the MCUBoot or/and the bootloader version for this to work ?

    hope to read from you soon

    best regards

    Ziv

  • Hi,

    ziv123 said:

    seems that moving to ncs 1.8 forces me to update to zephyr-sdk-0.13.2 (from 0.12.4) 

    is it really a must or am i missing something ?

    I'm not sure about this, I'm running Windows, so the Zephyr SDK is not available for my platform. What is forcing you to do this updat?

    ziv123 said:

    also, seems that when moving to the new zephyr sdk i have a problem with the dfu (based on the smp service), i use the nrfConnect for the dfu and it seems like its done ok but then after reset the version remains the old version. any ideas on why is that, maybe i need to change some configs ? 

    do i also need to update the MCUBoot or/and the bootloader version for this to work ?

    I would recommend you to post this issue in a new ticket, as it is off topic for this thread. That way, you will also get help from someone more knowledgeable about this topic than me.

    Best regards,
    Jørgen 

  • hi

    i will open a new thread on the ncs update  (wish i would have done that 10 days ago)

    currently the 'set_tx_power()' does not work for me but i moved to work on something else for the moment .. once the issue will be solved i will close this thread with the solution

    best regards

    Ziv

Reply Children
No Data
Related