Front-End Module (FEM / PA & LNA) and Antenna configuration¶
On MKW41Z, the system has two dedicated pins to control Front-End Modules (FEMs) and one pin to control the antenna. Those can be enabled outside of Mira.
On nRF52 platforms, Mira supports controlling FEMs with up to four pins and one pin for antenna selection. The rest of this documentation focuses mainly on configuring FEMs with nRF52.
How Mira uses FEMs¶
By default Mira uses Antenna 0 and the FEM turned on.
Gain¶
The purpose of having gain values in the configuration is to make Mira aware of the characteristics of the PA and antenna.
Mira assumes that the gain in the PA is constant and it's independent on input power, which is often not the case in reality. The gain values in the configuration are used by Mira to calculate the actual output power delivered.
When calling the Mira API to get or set the power, it will include the gains of both the nRF module and the PA.
Mira needs the gains in the configuration to be accurate and in order to be compliant with EN 300 328. Mira will not set the output power higher than 20 dBm, with the assumption that the configuration of the gains (including the antenna's) is correct.
Mira will also not turn on the CCA if the power is below 10 dBm, making it important to have accurate configuration. Otherwise, there is risk of breaking compliance.
If the antenna's gain is not part of the configuration's gain settings, make sure to compensate for the antenna when setting the output power. If a dipole antenna with a gain of 2.15 dBi is used, then the output power needs to be a set to a maximum of 17.85 dBm.
The nRF’s output power comes in certain steps. Therefore, after setting the power, it is important to verify that the measured power matches the desired value. When trying to set a non-supported output power value, Mira will round down to nearest supported value.
FEM controlling APIs¶
Configure FEMs¶
Mira supports the following five FEM modes:
- Active TX - the PA is boosting the sent signal.
- Active RX - the LNA is boosting the received signal.
- Bypass TX - the PA lets the signals through without much damping.
- Bypass RX - the LNA lets the signals through without much damping.
- Idle - the LNA/PA is in low power mode and may not let signals through.
Active mode is used when the FEM should be active, bypass mode when the radio should be used without a FEM. Idle is when the radio isn't used.
When using a FEM, Mira needs to be configured with the following information:
-
The gain values for each FEM mode, except for idle, Mira uses that information to fulfill regulatory and power requirements. The gain is configured in cB. One cB is 1/10th of a dB, i.e., 12 dB = 120 cB.
-
The GPIO pins that are connected to the FEM's control pins and the corresponding values they should have for each mode.
-
The GPIO pin used to select an antenna and the value it should have for each antenna.
The required information is configured as follows:
-
The gain values for each FEM mode are set individually.
-
Every GPIO control pin is given an index in the configuration. For example, the four control pins of nRF52 are assigned indices from 0 to 3. Each index is configured with a port (0 or 1) and a pin number.
-
The control pin values are assigned using a value parameter for each FEM mode. Each pin index number corresponds to the bit with the same number in the value parameter, i.e., pin index 0 corresponds to bit 0, pin index 1 corresponds to bit 1, and so on. The control pins would either be high (value = 1) or low (value = 0) for a particular mode, and accordingly, the value parameter is set for that mode.
-
Antenna selection is only done with a single pin and only bit 0 is used to control it.
The following example would give a deeper understanding of the steps required to configure the FEM module.
Example¶
This example describes the steps needed to configure Skyworks SE2346L FEM with nRF52840 target.
The pin states for each FEM mode according to the documentation:
Modes | CPS | CSD | CRX | CTX |
---|---|---|---|---|
Active TX | 1 | 1 | 0 | 1 |
Active RX | 1 | 1 | 1 | 0 |
Bypass TX | 0 | 1 | 0 | 1 |
Bypass RX | 0 | 1 | 1 | 0 |
Idle | 0 | 0 | 0 | 0 |
The GPIO pins of nRF52840 can be mapped to FEM control signals as follows:
- CTX = P1.12, it gets bit 0 = 2^0 = 1
- CRX = P1.14, it gets bit 1 = 2^1 = 2
- CSD = P1.10, it gets bit 2 = 2^2 = 4
- CPS = P1.11, it gets bit 3 = 2^3 = 8
The pins are in the same index as the order above. We specify the pins as [1, 12]
or MIRA_GPIO_PIN(1, 12)
etc depending on the configuration format.
According to this pin configuration and their state for each mode (from table above), the values for each mode becomes:
- Active TX = 8 + 4 + 1 = 13
- Active RX = 8 + 4 + 2 = 14
- Bypass TX = 4 + 1 = 5
- Bypass RX = 4 + 2 = 6
- Idle = 0
The antenna is connected through a switch connected to P1.6, where a high value connects the antenna to the FEM.
When configuring this in the certificate/license area, this json-file can be used:
{
"gain_cb_bypass_tx": -30,
"gain_cb_active_tx": 300,
"gain_cb_bypass_rx": -30,
"gain_cb_active_rx": 115,
"gpio_mode_control":[
[1,12],
[1,14],
[1,10],
[1,11]
],
"gpio_antsel":[[1,6]],
"pin_values_bypass_tx":5,
"pin_values_active_tx":13,
"pin_values_bypass_rx":6,
"pin_values_active_rx":14,
"pin_values_idle":0,
"pin_values_antsel":[0, 1, 0, 0],
"pin_values_antsel_idle":0,
}
const mira_net_frontend_config_t frontend = {
.gain_cb_bypass_tx = -30,
.gain_cb_bypass_rx = -30,
.gain_cb_active_tx = 300,
.gain_cb_active_rx = 115,
.gpio_mode_control = {
MIRA_GPIO_PIN(1, 12),
MIRA_GPIO_PIN(1, 14),
MIRA_GPIO_PIN(1, 10),
MIRA_GPIO_PIN(1, 11),
},
.gpio_antsel = MIRA_GPIO_PIN(1, 6),
.pin_values_bypass_tx = 5,
.pin_values_bypass_rx = 6,
.pin_values_active_tx = 13,
.pin_values_active_rx = 14,
.pin_values_idle = 0,
.pin_values_antsel = {
0, 1,
},
.pin_values_antsel_idle = 0,
};
Configuring with MiraOS¶
For MiraOS, the FEM can be configured in one of the following ways:
- Use a standard module configuration, see Configuration areas and the configure_module.py tool.
- Configure it through the license, see here
- Register a custom module configuration, see Core/System and the configure_module.py tool.
The custom module registration way of configuring FEMs is obsolete and will be removed in future versions of MiraOS.
Configuring with MiraMesh¶
MiraMesh' FEM configuration can be configured when calling miramesh_init
.
It can also get the configuration through the license like MiraOS, see here
Configuring with Mira Gateway¶
Mira Gateway can be configured with a standard module, just like MiraOS. It can also be configured with the license, like MiraOS.