Radio Control Layer (RCL)
TX Output Power

All RCL commands that involve a TX operation have a txPower field as part of the command struct in order to configure the TX output power.

The available TX power settings are found in a TX power table (LRF_TxPowerTable) provided as part of the radio setup, which is defined as follows:

LRF_TxPowerTable.png

Usage

For a normal user or stack developer, the usage will be as follows:

  • In the txPower field, the wanted dBm value of the TX power is written
  • Setting TX output power requires constructing a struct and setting the wanted value to the txPower field
  • The RCL will use the nearest entry in the table that is equal to or less than the requested power value (e.g. 7dBm might be rounded to 6dBm, and -5dBm might be rounded to -8dBm)
  • Special values (LRF_TxPower_Use_Min and LRF_TxPower_Use_Max) are available for selecting the maximum and minimum available TX power
  • If in the table, no output power is available below the requested setting, an error is returned

Examples

Recommended

The recommended way to set TX output power is using designated initializers, either setting .dBm and .fraction or .rawValue

void runGenericTxWithTxPowerSet(void)
{
ExampleRCL_GenericHdrDef hdrDef = FSK_hdrDef_DefaultRuntime();
/* Set up Tx buffers considering 4 packets, packet length of 200 bytes, 2 header bytes and 3 padding bytes */
RCL_Buffer_TxBuffer *txBuffers[NUM_PKT];
uint32_t pktBuffer[NUM_PKT][RCL_TxBuffer_len_u32(NUM_PAD, HDR_LEN, PKT_LEN)];
RCL_Handle h = RCL_open(&rclClient, &LRF_configGfsk500Kbps);
for (int i = 0; i < NUM_PKT; i++)
{
txBuffers[i] = (RCL_Buffer_TxBuffer *)pktBuffer[i];
}
/* Declare command */
RCL_CmdGenericTx cmd;
/* Command configuration */
cmd.common.scheduling = RCL_Schedule_AbsTime;
cmd.common.runtime.callback = defaultCallback;
cmd.common.runtime.rclCallbackMask = RCL_EventLastCmdDone;
cmd.rfFrequency = FREQUENCY;
cmd.syncWord = SYNCWORD;
/* Set TX output power */
/* Set txPower.dBm and txPower.fraction, with rawValue set accordingly */
cmd.txPower = (RCL_Command_TxPower) { .dBm = 7, .fraction = 0};
/* OR, set txPower.rawValue, with dBm and fraction are set according to rawValue */
cmd.txPower = (RCL_Command_TxPower) { .rawValue = 14};
generatePackets(txBuffers, NUM_PKT, PKT_LEN, &hdrDef, EXAMPLE_HDR);
for(int i = 0; i < NUM_PKT; i++)
{
RCL_TxBuffer_put(&cmd.txBuffers, txBuffers[i]);
}
/* Schedule first command considering a start delay of 600 us */
for (int i = 0; i < NUM_PKT; i++)
{
cmd.common.status = RCL_CommandStatus_Idle;
cmd.common.timing.absStartTime = nextTime;
/* Wait for command to conclude */
/* Schedule next command considering the same start delay */
}
}

Alternative

The user can also set TX output power by assigning the value to an existing structure's member.

/* Set txPower.dBm and txPower.fraction which combined form txPower.rawValue */
cmd.txPower.dBm = 7;
cmd.txPower.fraction = 0;
/* OR, set txPower.rawValue which combines dBm and fraction */
cmd.txPower.rawValue = 14;

Special settings

Special settings are another way to set the Tx output power, either to the maximum or the minimum available in the table

/* Use the lowest available value (min) in the table */
cmd.txPower = LRF_TxPower_Use_Min;
/* OR, use the highest available value (max) in the table */
cmd.txPower = LRF_TxPower_Use_Max;

Advanced

This setting is intented for advanced users only and is not recommended

If the user set txPower to Raw, then value.rawValue and the temperature coefficient needs to be set.

/* TX power register is set to a special value.
* The value must be given with the API RCL_Command_setRawTxPower prior to starting the command
*/
cmd.txPower = LRF_TxPower_Use_Raw;
uint32_t value = 31520;
uint32_t temperatureCoefficient = 80;
RCL_Command_setRawTxPower(value, temperatureCoefficient);