How to set KW36 Tx power

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to set KW36 Tx power

How to set KW36 Tx power

Symptoms

In the KW36 SDK, there is an API bleResult_t Controller_SetTxPowerLevel(uint8_t level, txChannelType_t channel) to set the Tx power, but the unit of param[in] level is not dBm.

But how do we set a Tx power in dBm?

Diagnosis

By going through the source code, we found that two conversions are required between the actual dBm and the set value of the API.

One is PA_POWER to Transmit Output Power conversion table:

xing_chang_0-1626671502649.png

 

xing_chang_1-1626671511075.png

 

Other is Level to PA_POWER  conversion table:

 .tx_power[0] = 0x0001,    .tx_power[1] = 0x0002,    .tx_power[2] = 0x0004,    
.tx_power[3] = 0x0006,    .tx_power[4] = 0x0008,    .tx_power[5] = 0x000a,    
.tx_power[6] = 0x000c,    .tx_power[7] = 0x000e,    .tx_power[8] = 0x0010,    
.tx_power[9] = 0x0012,    .tx_power[10] = 0x0014,    .tx_power[11] = 0x0016,    
.tx_power[12] = 0x0018,    .tx_power[13] = 0x001a,    .tx_power[14] = 0x001c,    
.tx_power[15] = 0x001e,    .tx_power[16] = 0x0020,    .tx_power[17] = 0x0022,   
 .tx_power[18] = 0x0024,    .tx_power[19] = 0x0026,    .tx_power[20] = 0x0028,   
 .tx_power[21] = 0x002a,    .tx_power[22] = 0x002c,    .tx_power[23] = 0x002e,    
.tx_power[24] = 0x0030,    .tx_power[25] = 0x0032,    .tx_power[26] = 0x0034,   
 .tx_power[27] = 0x0036,    .tx_power[28] = 0x0038,    .tx_power[29] = 0x003a,    
.tx_power[30] = 0x003c,    .tx_power[31] = 0x003e,

The input parameter 'level' of the API is the subscript of this array. The array value is PA_POWER of first conversion table, then we can find the final Tx power.

From another perspective, the parameter 'level' is the index of the first table.

 

Solution

The following demonstrates a conversion process.

xing_chang_2-1626672207311.png

 

No ratings
Version history
Last update:
‎07-18-2021 10:44 PM
Updated by: