How to set the BLE TX power level in code

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
chsi_1572801
Level 3
Level 3
First like received

Hello

   

I am working with the PRoC 4 system and am trying to set the TX power level in code using the CyBle_SetTxPowerLevel() function and it doesn't seem to be working. For testing I have a Android application that is continually reporting the RSSI level from the connected PRoC system. I can see in the CyBle_eventHandler.c that the TX power level is set to 0dB which matches the settings in my BLE configuration under Connection TX power level. With this setting and with the distance of one meter between the Android device and  the PRoC device I am seeing -38dB RSSI. When I  set 'bleSsPwrLvl.blePwrLevelInDbm = CYBLE_LL_PWR_LVL_NEG_18_DBM' and 'bleSsPwrLvl.bleSsChId = CYBLE_LL_CONN_CH_TYPE' and then call CyBle_SetTxPowerLevel(&bleSsPwrLvl) after my Ble_Init() I see no decrease in RSSI dB on the Android device. Does anyone have any ideas on this issue?

   

Thanks 

0 Likes
1 Solution
AuCo_1640856
Level 2
Level 2
First like received

Hi Chris,

   

Our problem looks solved. Technically the API call is working. We got pretty confused due to a bug in our code where we were calling CyBle_SetTxPowerLevel with an out of range enum. The API call does not return an error, but has some strange effect where the power level gets changed on both advertising and connection channels

View solution in original post

0 Likes
7 Replies
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received
        RSSI can be affected by other ble signals in the area and using an Arduino board is not the best device to determine power level of the transmitter. I would use a spectrum analyzer for true readings.   
0 Likes
chsi_1572801
Level 3
Level 3
First like received

The board in use is a CY5674 PRoC BLE SMA board. The issue is that when I set the power level with BLE configuration under Connection TX power level from 0dB to -18dB I see a change on the android device from -38dB to -60dB. When I make the same change in code by calling CyBle_SetTxPowerLevel() function there is no change on the Android device. I am not worried about exact power levels. My issue is that the CyBle_SetTxPowerLevel() function isn't working.

   

Thanks 

0 Likes
AuCo_1640856
Level 2
Level 2
First like received

Hello,

   

Did you ever get a satisfactory answer to your question. We are having exactly the same problem.

   

We use the API call CyBle_SetTxPowerLevel() and then check it using CyBle_GetTxPowerLevel() and it reports the level has been changed. But clearly it's not according to our measurements, as making power level changes from -18dB to +3dB causes no noticeable difference in the RSSI. I know this method is not full proof, but using exactly the same measurement setup and the Cypress app to change the power level via the radio connection results in RSSI changes of 30 dB

   

What are we doing wrong is there some other API call that must take place after CyBle_SetTxPowerLevel()? Do we have to reinitialize the stack? I'm at wits end here!!

   

Forgot to say the target device is a EZ-BLE PRoC Module CYBLE-222005-00

   

Please can anyone help

0 Likes

Hello

   

I never did get this working. I ended up just going with a static setting in the configure BLE GAP Settings. I would recommend you open a cypress support case. I have had a lot of success using there support group.

   

-Chris

0 Likes
AuCo_1640856
Level 2
Level 2
First like received

Thanks for the quick reply. I've now raised a case and I'll let you know if I get a resolution.

0 Likes
AuCo_1640856
Level 2
Level 2
First like received

Hi Chris,

   

Our problem looks solved. Technically the API call is working. We got pretty confused due to a bug in our code where we were calling CyBle_SetTxPowerLevel with an out of range enum. The API call does not return an error, but has some strange effect where the power level gets changed on both advertising and connection channels

0 Likes

Great news. Its good to know that you got it worked out. If I end up needing it in the future I will know it does work.

   

-Chris