4 Replies Latest reply on Mar 31, 2016 2:59 AM by userc_39500

    About Tx Power

      Can somebody give me information about how I shall use "Tx Power" in Bluetooth Smart? My concerns:

      • There is an API function CyBle_SetTxPowerLevel(). What does this do, and how do I use it? And should I use it; do I have to call it in my application? What are the benefits by using it, can I for example save power?
      • How can I use the values given by the API function CyBle_GetRssi()? And must I have configured the BLE component first in order to get correct values, for example by using CyBle_SetTxPowerLevel()?
      • Advertisement Data has a field named Tx Power Level (this field can actually be configured by the Cypress BLE component). In fact, this field is mandatory for peripherals targeting iOS, see https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf. But how do I know what value(s) this field shall have? And do the two functions I mentioned above affect the value?

      I am programming a PSoC4BLE on a custom board with an external antenna.

        • 1. Re: About Tx Power



          I can try to give you some explanations about your questions. I'm not expert about BLE, but at least I hope I can give you some hints till some BLE experts get here.




          1: You can configure the output tx power either from BLE Component in GUI or with that API in your code. +3dBm is the maximum TX power level and -18dBm is the minimum TX power level. It adjusts your output power which directly affects to the BLE range. Naturally, you will increase your range when you set it to a higher power level, but it will cause much more power consumption in your design. You must decide which power level fits your range requirements and power consumption considerations.


          2: RSSI is an abbreviation for "received signal strength indicator". As you can understand from the name, it gives you information about signal strength taken from a bluetooth device. For example, when you scan the bluetooth devices around you, you can see their RSSI values change when you move away your host bluetooth device(e.g. your mobile phone). If you increase the TX power level for a device, you can observe that device from much higher distance when you scan it with another device. RSSI is how strength you can receive signals from another device.


          3: You can set the TX power level from BLE component menu in GUI(TopDesign) or in your code with API CyBle_SetTxPowerLevel(). You can see it in the Advertisement Settings tab in the gui. You can simply enable the TX Power Level to be located in your advertisement data. When you tick up the Tx Power level from Advertisement Data tab, it adds the TX Power Level value ,which you just set from the gui or in API to the advertisement data.

          2 of 2 people found this helpful
          • 2. Re: About Tx Power

            Thanks for your patience to write a cohesive answer :) It seems that the function CyBle_EventHandler(), generated by the BLE component, sets the Tx Power values for us (as generated by the component). Since I use a custom event handler, I probably need to call the CyBle_SetPowerLevel() function myself.


            Do you think the BLE component will modify the Tx Power Level field of Advertisement Data in runtime when calling CyBle_SetPowerLevel(), and also when Advertisement Data is set manually by CyBle_UpdateAdvData()?


            I suppose the zero Tx Power level (which is measured in dBm) is relative to some value. Is this zero reference value defined in the specs, and hence is the same on all Bluetooth radios?


            BTW, I found an official blog post about RSSI here: http://blog.bluetooth.com/proximity-and-rssi/ .

            • 3. Re: About Tx Power

              As I know, tx power is the known measured signal strength in RSSI at 1 meter away. For example in beacon applications, you read the TX Power Level from advertisement data of beacon by your mobile phone app and compare it with the RSSI value and get a bit of information about the location of beacon( this is not enough for location estimation but just an example)


              I don't know whether I understood your first paragraph properly or not, but the advertisement data is generated in the BLE.c file, you can see the advertisement data in "discoverydata" array. (I don't remember the proper name but you can find it with a related search)


              I'm not sure whether or not it modifies the Advertisement Data with the new Tx Power level, but you can simply test it with one of those example projects. I guess it should modify it because the GUI actually is for generating source files. So if you enable Advertising Tx Power Level in advertisement data from GUI, it justs generates necessary sources for that and then(I guess so) reads the Tx Power Level from that source file. If you use the API CyBle_SetPowerLevel(), it also modifies the source file which contains the Tx Power Level, you can see it by right-clicking the function and "Go to definition".


              I didn't use the API CyBle_UpdateAdvData(), but you can simply change the advertisement data by accessing it without using CyBle_UpdateAdvData()


              cyBle_discoveryData.advData[10] =  0xF2;   // Tx Power Level -14dBm


              //Note that this only adds the Tx Power Level to a custom byte. If you want to see the Tx //Power Level service with CySmart or any host application, you need to add service length //and service id bytes too, or simply add it by using GUI.



              I recommend you to test what you need. If you have a mobile phone and psoc4ble, you can simply observe those changes in the host application. 





              • 4. Re: About Tx Power

                Unfortunately, CyBle_SetTxPowerLevel() is part of BLE_Stack.h, so the implementation is closed source (this is not Cypress' fault, it's because Bluetooth SIG has requirements for manufacturers of Bluetooth chips so the user don't violate the their rules). I guess the best solution is to just test Advertisement Data with CySmart.




                But I found that I do not need to set TxPower (and other values like device name) when I use a custom event handler with CyBle_Start( &my_handler ). The actual event handler is CyBle_EventHandler() and this calls my_handler() at end. At startup, CyBle_EventHandler() sets these values upon CYBLE_EVT_STACK_ON (the documentation is very confusing, I must tell Cypress about that).