## RFFE Radio Frequency Front End Macro Definition Documentation

### STABILIZATION_DELAY

#define STABILIZATION_DELAY (SystemCoreClock * 3 / 625)

External include files.

Three times the length of time corresponding to the minimum sample rate, which is deemed sufficient to allow the LSAD to stabilize

Location: rffe.h:46

### MEASUREMENT_DELAY

#define MEASUREMENT_DELAY (SystemCoreClock / 625)

Corresponds to sample rate of the LSAD as configured (625 Hz)

Location: rffe.h:49

### V_TO_MV

#define V_TO_MV 1000

Factor for converting back and forth from mV to V.

Location: rffe.h:52

### V_TO_MV_F

#define V_TO_MV_F 1000.0f

Float iteration of factor for converting back and forth from mV to V.

Location: rffe.h:55

### DEF_CHANNEL

#define DEF_CHANNEL 6

Default LSAD channel used to measure voltage rails.

Location: rffe.h:58

### MAX_LSAD_CHANNEL

#define MAX_LSAD_CHANNEL 7

Maximum number of LSAD channels in the design.

Location: rffe.h:61

### VDDPA_EN

#define VDDPA_EN 1

VDDPA enable selection.

Location: rffe.h:64

### VDDPA_DIS

#define VDDPA_DIS 0

VDDPA disable selection.

Location: rffe.h:67

### VCC_VDDRF_MARGIN

#define VCC_VDDRF_MARGIN 50

We strongly recommended having VCC at least 50mV higher than VDDRF.

Location: rffe.h:70

### TRIM_MARGIN

#define TRIM_MARGIN 10 /*mv*/

Trim margin.

The granularity of trims for VDDRF allow for a certain error above or below the set value

Location: rffe.h:74

### MV_PER_DBM_VDDPA

#define MV_PER_DBM_VDDPA 100

Estimated voltage increase per 1dBm increased TX power.

Location: rffe.h:77

### MV_PER_DBM_VDDRF

#define MV_PER_DBM_VDDRF 75

Estimated voltage increase per 1dBm increased TX power.

Location: rffe.h:80

### STEPS_PER_DBM_VDDRF

#define STEPS_PER_DBM_VDDRF 6

Estimated trim steps per 1dBm increased TX power.

Location: rffe.h:83

### STEPS_PER_DBM_VDDPA

#define STEPS_PER_DBM_VDDPA 10

Estimated trim steps per 1dBm increased TX power.

Location: rffe.h:86

### RF_MAX_POWER

#define RF_MAX_POWER 6

Maximum RF output power possible.

Location: rffe.h:89

### RF_MAX_POWER_NO_VDDPA

#define RF_MAX_POWER_NO_VDDPA 2

Maximum RF output power possible without using VDDPA.

Location: rffe.h:92

### RF_NO_VDDPA_TYPICAL_POWER

#define RF_NO_VDDPA_TYPICAL_POWER 0

Typical RF output power when VDDPA is not used, with default trims.

Location: rffe.h:95

### RF_DEFAULT_POWER

#define RF_DEFAULT_POWER 0

RF output power used by default.

Location: rffe.h:98

### RF_MIN_POWER

#define RF_MIN_POWER -17

Minimum possible RF output power.

Location: rffe.h:101

### PA_PWR_BYTE_0DBM

#define PA_PWR_BYTE_0DBM 0x0C

RF Output Power code for 0dBm.

Location: rffe.h:104

### PA_ENABLE_BIAS_SETTING

#define PA_ENABLE_BIAS_SETTING 0xF3

Power amplifier bias enable.

Location: rffe.h:107

### PA_DISABLE_BIAS_SETTING

#define PA_DISABLE_BIAS_SETTING 0x73

Power amplifier bias disable.

Location: rffe.h:110

### SW_CTRL_DELAY_3_BYTE

#define SW_CTRL_DELAY_3_BYTE ((uint8_t)0x2U)

Switch control delay.

Location: rffe.h:114

### RAMPUP_DELAY_3_BYTE

#define RAMPUP_DELAY_3_BYTE ((uint8_t)0x2U)

Ramp-up delay.

Location: rffe.h:117

### DISABLE_DELAY_3_BYTE

#define DISABLE_DELAY_3_BYTE ((uint8_t)0x2U)

Disable delay.

Location: rffe.h:120

### ERRNO_TX_POWER_MARKER

#define ERRNO_TX_POWER_MARKER 0x30

Error marker for RFFE errors.

Location: rffe.h:124

### ERRNO_NO_TRIMS

#define ERRNO_NO_TRIMS (0x01 | ERRNO_TX_POWER_MARKER)

No trims found when attempting to adjust voltage rails.

Location: rffe.h:127

### ERRNO_RFFE_MISSINGSETTING_ERROR

#define ERRNO_RFFE_MISSINGSETTING_ERROR (0x02 | ERRNO_TX_POWER_MARKER)

Setting does not exist.

Location: rffe.h:130

### ERRNO_RFFE_INVALIDSETTING_ERROR

#define ERRNO_RFFE_INVALIDSETTING_ERROR (0x03 | ERRNO_TX_POWER_MARKER)

Setting is not possible.

Location: rffe.h:133

### ERRNO_RFFE_VCC_INSUFFICIENT

#define ERRNO_RFFE_VCC_INSUFFICIENT (0x04 | ERRNO_TX_POWER_MARKER)

VCC is too low to increase VDDRF sufficiently to suppor the requested RF output power.

Location: rffe.h:136

### WARNING_RFFE_VLOW_POWER_STATE

#define WARNING_RFFE_VLOW_POWER_STATE (0x05 | ERRNO_TX_POWER_MARKER)

Warning that the device is in a very low RF output power state.

Location: rffe.h:140

### WARNING_RFFE_PA_ENABLED_STATE

#define WARNING_RFFE_PA_ENABLED_STATE (0x06 | ERRNO_TX_POWER_MARKER)

Warning that the device has the power amplifier enabled.

Location: rffe.h:143

### CONVERT

#define CONVERT ((uint32_t)((x * 1000) >> 13))

Converts an ADC code to a voltage, calculated as follows voltage = adc_code * (2 V * 1000 [mV]/1 V / 2^14 steps).

Location: rffe.h:154

Parameters

Direction | Name | Description
--- | --- | ---
in | x | the ADC code input

Return

The voltage output in mV

Assumptions

Low frequency mode for the ADC is used, meaning that the resolution of the ADC is 14-bits. CONVERT provides voltage level as a milliVolt value based on the input ADC code.

### SWAP

#define SWAP ((t) = (a), (a) = (b), (b) = (t))

Swap the values in variables a and b.

Location: rffe.h:164

Parameters

Direction | Name | Description
--- | --- | ---
in | a | holds the value that must go to b
in | b | holds the value that must go to a
in | t | a temporary buffer for the swap

Return

b holds the value previously in a

### SYS_RFFE_SETTXPOWER

#define SYS_RFFE_SETTXPOWER Sys_RFFE_SetTXPower(target, DEF_CHANNEL, VDDPA_DIS)

Set the TX Power according to the desired target value with an accuracy of +/-1 dBm for +6 dBm to -17 dBm.

This function sets VDDRF, VDDPA, and PA_PWR (RF_REG1A) when applicable. Note: This function provides RF TX power configurations that match the requested levels, without considering the potential for increased power consumption due to the use of VDDPA.

Location: rffe.h:208

Parameters

Direction | Name | Description
--- | --- | ---
in | target | Target transmission power in the range from -17 to +6 dBm in 1 dBm increments.

Return

Return value error value, if any

Example Code for SYS_RFFE_SETTXPOWER
// Reads the current register settings and measures VDDRF, if requried, to // determine the current TX power setting. result = SYS_RFFE_SETTXPOWER(0);