Skip to content

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 document is about FEMs on the nRF52.

How Mira uses FEMs

By default Mira uses Antenna 0 and the FEM turned on.

Gain

The gains of 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, dependent on input power - which it often is not in reality. The gain values in the configuration is used by Mira to calculate the actual output power delivered.

When calling the API to get or set the power, it will include both the nRF's and the PA's gain.

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 one 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 one uses a dipole of 2.15 dBi, one need to set the output power to a max of 17.85 dBm.

The nRF’s output power comes in certain steps. That means it is important to check what the output power is after one has set it, to make sure it is the desired. Mira will round down to nearest possible output power if one selected a non-possible output power value.

FEM controlling APIs

Configure FEMs

When using a FEM, Mira must be configured with some information about it.

FEMs can be in up to five 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.

Except for idle, Mira needs to know how much gain the FEM provides. Mira use that to fulfill regulation and power requirements. The gain is configured in cB. One cB is 1/10th of a dB, ie 12dB = 120cB.

Mira also needs to know what GPIO pins are connected to the FEM and what values they should have in each mode. It also needs to know if a pin is used to select an antenna and what values it should have for each antenna.

The control pins are given an index in the configuration, from 0 to 3.

Each index is configured with a port (0 or 1) and a pin number.

Each index number corresponds to a bit with the same number and the bits are combined to a value for each mode.

Antenna selection is only done with a single pin and only bit 0 (value=1) is used to control it.

Example

This example describes how the MWA-N2-B module's FEM is configured.

The signals are connected to the nRF52840 like this:

  • 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 FEM's documentation says its pins should be used like this:

  • Active TX = CPS=1 CSD=1 CRX=0 CTX=1
  • Active RX = CPS=1 CSD=1 CRX=1 CTX=0
  • Bypass TX = CPS=0 CSD=1 CRX=0 CTX=1
  • Bypass RX = CPS=0 CSD=1 CRX=1 CTX=0
  • Idle = CPS=0 CSD=0 CRX=0 CTX=0

To configure the FEM, we give the pins 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.

Then the values for the different modes become:

  • 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,
}

Configuring it as a custom module:

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),
        MIRA_GPIO_PIN_UNDEFINED,
    },

    .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

On MiraOS configure the FEM in one of these ways:

  • Use a standard module configuration, see Configuration areas and the configure_module.py tool.
  • Configuration 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.