diff --git a/mpsl/CHANGELOG.rst b/mpsl/CHANGELOG.rst
index f2361e3543..5595406341 100644
--- a/mpsl/CHANGELOG.rst
+++ b/mpsl/CHANGELOG.rst
@@ -15,6 +15,9 @@ Changes
using :cpp:func:`mpsl_timeslot_session_count_set`. All APIs timeslot APIs now take
a session_id as input. The session id is retrieved from :cpp:func:`mpsl_timeslot_session_open()`.
+* Added API to use Front-End Modules (nRF21540 GPIO and simple GPIO) by the protocols and API to
+ configure them by the application. Only nRF52 series is supported.
+
Bugfixes
========
@@ -43,8 +46,8 @@ Added
Changes
=======
* Removed ``MPSL_RADIO_NOTIFICATION_DISTANCE_425US`` and replaced it by ``MPSL_RADIO_NOTIFICATION_DISTANCE_420US``.
-* On nRF53, the fix for Errata 16 is now applied.
-* The scheduling overhead of a timeslot event is reduced.
+* On nRF53, the fix for Errata 16 is now applied.
+* The scheduling overhead of a timeslot event is reduced.
Bugfixes
========
diff --git a/mpsl/README.rst b/mpsl/README.rst
index ce21d2a18c..508243c338 100644
--- a/mpsl/README.rst
+++ b/mpsl/README.rst
@@ -13,6 +13,7 @@ Key features of this library include:
* Radio notifications - a configurable interrupt before and/or after radio activity.
* TX Power control - the MPSL TX Power interface provides APIs to set the maximum TX power per channel.
* Clock control - APIs for configuring and controlling the low and high-frequency clock.
+* FEM - APIs for controlling external Front-End Modules (only nRF52 series is supported).
* API for obtaining the temperature measured on the SoC.
.. important::
@@ -32,4 +33,5 @@ Key features of this library include:
doc/timeslot
doc/radio_notification
doc/tx_power_control
+ doc/fem
doc/api
diff --git a/mpsl/doc/api.rst b/mpsl/doc/api.rst
index ae4c55ed0e..376f8b1f07 100644
--- a/mpsl/doc/api.rst
+++ b/mpsl/doc/api.rst
@@ -38,6 +38,34 @@ MPSL TX Power
:project: nrfxlib
:members:
+MPSL FEM
+********
+
+.. doxygengroup:: mpsl_fem
+ :project: nrfxlib
+ :members:
+
+MPSL FEM common configuration
+*****************************
+
+.. doxygengroup:: mpsl_fem_config_common
+ :project: nrfxlib
+ :members:
+
+MPSL FEM nRF21540 GPIO
+**********************
+
+.. doxygengroup:: mpsl_fem_nrf21540_gpio
+ :project: nrfxlib
+ :members:
+
+MPSL FEM Simple GPIO
+********************
+
+.. doxygengroup:: mpsl_fem_simple_gpio
+ :project: nrfxlib
+ :members:
+
MPSL Temp
*********
diff --git a/mpsl/doc/fem.rst b/mpsl/doc/fem.rst
new file mode 100644
index 0000000000..bf27db26c7
--- /dev/null
+++ b/mpsl/doc/fem.rst
@@ -0,0 +1,127 @@
+.. _mpsl_fem:
+
+Front-End Module feature
+########################
+
+The Front-End Module feature allows the application to interface with several types of Front-End Modules (FEMs).
+This allows to increase the transmitted power through a Power Amplifier (PA) or increase the sensitivity through a Low-Noise Amplifier (LNA).
+Any increase in power and sensitivity results in an increased communication range.
+The exact PA and LNA gains are dependent on the specific FEM used.
+
+Implementation
+**************
+
+Two FEM implementations are provided:
+
+* *nRF21540 GPIO* - compatible with nRF21540 FEM, implementing a 3-pin interface.
+* *Simple GPIO* - simplified version for supporting other Front-End Modules, implementing a 2-pin interface.
+
+Both implementations use PA and LNA pins for controlling the FEM.
+Additionally, the nRF21540 GPIO implementation uses the PDN pin for powering down FEM internal circuits to reduce energy consumption.
+
+Configurable timings
+********************
+
+In both implementations, two timings can be configured:
+
+* ``LNA time gap`` - the time between LNA activation and the start of radio reception.
+* ``PA time gap`` - the time between PA activation and the start of radio transmission.
+
+For nRF21540, two additional timings can also be configured:
+
+* ``TRX hold time`` - the time interval for which the FEM is kept powered up after the PDN deactivation event occurs.
+* ``PDN settle time`` - the time interval before the PA or LNA activation reserved for the FEM ramp-up.
+
+General usage
+*************
+
+The Power Amplifier and the Low-Noise Amplifier are responsible for, respectively, transmission and reception and are configured and activated independently.
+The two functionalities can't be configured and set to operate simultaneously as they share some resources.
+As such, after operating with a Power Amplifier, the PA configuration must be cleared to be able to configure and use a Low-Noise Amplifier afterward, and vice versa.
+
+Both amplifiers are controlled through activation and deactivation events.
+Two types of events are supported:
+
+* *timer event* - ``COMPARE`` event of a hardware timer, can be used for both PA/LNA activation and deactivation.
+* *generic event* - any other event type, can only be used for PA/LNA deactivation.
+
+Preparing a generic event only requires the application to provide the event register.
+Preparing a timer event requires the application to provide:
+
+* The instance of the timer, which the protocol has to start by itself.
+* The *Compare Channels* mask, which tells the Front End Module which Compare Channels of the provided Timer are free to use.
+* The Start time, at which the Front End Module can start preparing the PA or LNA.
+* The End time, at which the Front End Module must be ready for the RF procedure.
+
+The module will then configure the timer so that the FEM is activated or deactivated accordingly, taking into account the FEM ramp-up time.
+
+See below for an example of activating LNA for Rx operation, using the following parameters:
+
+* Time scheduled by the application (RX ramp-up) - 40 us
+* LNA ramp-up time - ``13 us``
+* LNA deactivation event - ``rx_end``
+* LNA activation timer - ``TIMER0``
+
+See below for the steps needed to properly configure LNA in this example:
+
+* The application configures the LNA to be activated by the timer event, with the start time set to 0 us and the end time set to 40 us.
+* The application provides the ``rx_end`` event as the LNA deactivation event.
+* The FEM module reads the scheduled time and sets ``TIMER0`` compare channel to 27 us, as a result of the RX ramp-up time (40 us) minus the LNA ramp-up time (13 us).
+* The application starts the RX operation.
+* The application starts ``TIMER0``.
+
+The following picture illustrates the timings in this scenario:
+
+.. figure:: pic/FEM_timing_simple.svg
+ :alt: Timing of LNA pin for reception
+
+ Timing of LNA pin for reception
+
+The following picture illustrates the calls between the application, the FEM module, and the hardware in this scenario:
+
+.. figure:: pic/FEM_sequence_simple.svg
+ :alt: Sequence diagram of LNA control for reception
+
+ Sequence diagram of LNA control for reception
+
+nRF21540 usage
+**************
+
+In the nRF21540 implementation, the PDN pin is used to power down the FEM internal circuits.
+The FEM can be powered down on application request, configuring the activation timer event, similarly to PA and LNA pins.
+The FEM is powered back up automatically before PA or LNA are activated.
+
+See below for an example of controlling LNA and PDN during Rx operation, using the following parameters:
+
+* Time scheduled by application - 40 us
+* LNA ramp-up time - 13 us
+* PDN settle time - 18 us
+* TRX hold time - 5 us
+* LNA deactivation event - ``rx_end``
+* PDN deactivation event - ``rx_end``
+* PDN activation timer - ``TIMER0``
+* LNA activation timer - ``TIMER1``
+
+See below for the steps needed to properly configure LNA and PDN in this example:
+
+* The application configures the power-down by passing ``rx_end`` as the activation event.
+* The FEM module connects the activation event with the ``TIMER0`` start task through PPI and sets TRX hold time to 5 us.
+* The application configures LNA to be activated by the timer event, with the start time set to 0 us and end time set to 40 us.
+* The application provides the ``rx_end`` event as the LNA deactivation event.
+* The FEM module reads the scheduled time and sets ``TIMER1`` compare channels to 27 us (40-13) and 9 us (27-18).
+* The application starts Rx operation.
+* The application starts ``TIMER1``.
+
+The following picture illustrates the timing in this scenario:
+
+.. figure:: pic/FEM_timing_nRF21540.svg
+ :alt: Timing of LNA and PDN pins for reception
+
+ Timing of LNA and PDN pins for reception
+
+The following picture presents the calls between the application, the FEM module, and the hardware in this scenario:
+
+.. figure:: pic/FEM_sequence_nRF21540.svg
+ :alt: Sequence diagram of LNA and PDN control for reception
+
+ Sequence diagram of LNA and PDN control for reception
diff --git a/mpsl/doc/pic/FEM_sequence_nRF21540.svg b/mpsl/doc/pic/FEM_sequence_nRF21540.svg
new file mode 100644
index 0000000000..83f7b8e43d
--- /dev/null
+++ b/mpsl/doc/pic/FEM_sequence_nRF21540.svg
@@ -0,0 +1,47 @@
+
+
\ No newline at end of file
diff --git a/mpsl/doc/pic/FEM_sequence_simple.svg b/mpsl/doc/pic/FEM_sequence_simple.svg
new file mode 100644
index 0000000000..6435e7064b
--- /dev/null
+++ b/mpsl/doc/pic/FEM_sequence_simple.svg
@@ -0,0 +1,31 @@
+
+
\ No newline at end of file
diff --git a/mpsl/doc/pic/FEM_timing_nRF21540.svg b/mpsl/doc/pic/FEM_timing_nRF21540.svg
new file mode 100644
index 0000000000..4e5d0c4a3d
--- /dev/null
+++ b/mpsl/doc/pic/FEM_timing_nRF21540.svg
@@ -0,0 +1,60 @@
+
+
\ No newline at end of file
diff --git a/mpsl/doc/pic/FEM_timing_simple.svg b/mpsl/doc/pic/FEM_timing_simple.svg
new file mode 100644
index 0000000000..52ddd90596
--- /dev/null
+++ b/mpsl/doc/pic/FEM_timing_simple.svg
@@ -0,0 +1,44 @@
+
+
\ No newline at end of file
diff --git a/mpsl/include/mpsl_fem_config_common.h b/mpsl/include/mpsl_fem_config_common.h
new file mode 100644
index 0000000000..784d396d37
--- /dev/null
+++ b/mpsl/include/mpsl_fem_config_common.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2020 Nordic Semiconductor ASA
+ *
+ * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
+ */
+
+/**
+ * @file mpsl_fem_config_common.h
+ *
+ * @defgroup mpsl_fem_config_common MPSL Front End Module Common Configuration parts
+ * @ingroup mpsl_fem
+ *
+ * The MPSL Front End Module Common Configuration defines structures common for every supported Front End Module.
+ * @{
+ */
+
+#ifndef MPSL_FEM_CONFIG_COMMON_H__
+#define MPSL_FEM_CONFIG_COMMON_H__
+
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @brief Configuration parameters for pins that enable or disable (or both) either Power Amplifier (PA) or Low Noise Amplifier (LNA).
+ */
+typedef struct
+{
+ bool enable; /**< Enable toggling for this pin. */
+ bool active_high; /**< If true, the pin will be active high. Otherwise, the pin will be active low. */
+ uint8_t gpio_pin; /**< GPIO pin number for the pin. */
+ uint8_t gpiote_ch_id; /**< The GPIOTE channel used for toggling this pin. */
+} mpsl_fem_gpiote_pin_config_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MPSL_FEM_CONFIG_COMMON_H__
+
+/**@} */
diff --git a/mpsl/include/mpsl_fem_config_nrf21540_gpio.h b/mpsl/include/mpsl_fem_config_nrf21540_gpio.h
new file mode 100644
index 0000000000..7e58123ba6
--- /dev/null
+++ b/mpsl/include/mpsl_fem_config_nrf21540_gpio.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2020 Nordic Semiconductor ASA
+ *
+ * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
+ */
+
+/**
+ * @file mpsl_fem_config_nrf21540_gpio.h
+ *
+ * @defgroup mpsl_fem_nrf21540_gpio MPSL nRF21540 GPIO Front End Module Configuration
+ * @ingroup mpsl_fem
+ *
+ * The MPSL nRF21540 GPIO Front End Module Configuration defines the configuration of the nRF21540 GPIO Front End Module.
+ * @{
+ */
+
+#ifndef MPSL_FEM_CONFIG_NRF21540_GPIO_H__
+#define MPSL_FEM_CONFIG_NRF21540_GPIO_H__
+
+#include
+#include
+#include "mpsl_fem_config_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @brief Configuration parameters for the PA/LNA interface in the nRF21540 GPIO variant
+ */
+typedef struct
+{
+ struct
+ {
+ uint32_t pa_time_gap_us; /**< Time between the activation of the PA pin and the start of the radio transmission. Should be no bigger than Radio Ramp-Up time. */
+ uint32_t lna_time_gap_us; /**< Time between the activation of the LNA pin and the start of the radio reception. Should be no bigger than Radio Ramp-Up time. */
+ uint32_t pdn_settle_us; /**< The time between activating the PDN pin and activating the PA/LNA pin. */
+ uint32_t trx_hold_us; /**< The time between deactivating the PA/LNA pin and deactivating the PDN pin. */
+ int8_t pa_gain_db; /**< Configurable PA gain. Ignored if the amplifier is not supporting this feature. */
+ int8_t lna_gain_db; /**< Configurable LNA gain. Ignored if the amplifier is not supporting this feature. */
+ } fem_config; /**< Configuration structure of the nRF21540 GPIO. */
+
+ mpsl_fem_gpiote_pin_config_t pa_pin_config; /**< Power Amplifier pin configuration. */
+ mpsl_fem_gpiote_pin_config_t lna_pin_config; /**< Low Noise Amplifier pin configuration. */
+ mpsl_fem_gpiote_pin_config_t pdn_pin_config; /**< Power Down pin configuration. */
+
+ uint8_t ppi_channels[3]; /**< Array of PPI which need to be provided to Front End Module to operate. */
+
+} mpsl_fem_nrf21540_gpio_interface_config_t;
+
+/** @brief Configures the PA and LNA device interface.
+ *
+ * This function sets device interface parameters for the PA/LNA module.
+ * The module can then be used to control a power amplifier or a low noise amplifier (or both) through the given interface and resources.
+ *
+ * The function also sets the PPI and GPIOTE channels to be configured for the PA/LNA interface.
+ *
+ * @param[in] p_config Pointer to the interface parameters for the PA/LNA device.
+ *
+ * @retval 0 PA/LNA control successfully configured.
+ * @retval -NRF_EPERM PA/LNA is not available.
+ *
+ */
+int32_t mpsl_fem_nrf21540_gpio_interface_config_set(mpsl_fem_nrf21540_gpio_interface_config_t const * const p_config);
+
+/**
+ * nRF21540 GPIO Front End Module Timings
+ */
+
+/** Time in microseconds when PA GPIO is activated before the radio is ready for transmission. */
+#define MPSL_FEM_NRF21540_GPIO_DEFAULT_PA_TIME_IN_ADVANCE_US 13
+
+/** Time in microseconds when LNA GPIO is activated before the radio is ready for reception. */
+#define MPSL_FEM_NRF21540_GPIO_DEFAULT_LNA_TIME_IN_ADVANCE_US 13
+
+/** The time between activating the PDN and asserting the RX_EN/TX_EN. */
+#define MPSL_FEM_NRF21540_GPIO_DEFAULT_PDN_SETTLE_US 18
+
+/** The time between deasserting the RX_EN/TX_EN and deactivating PDN. */
+#define MPSL_FEM_NRF21540_GPIO_DEFAULT_TRX_HOLD_US 5
+
+/**
+ * nRF21540 GPIO Front End Module Gains
+ *
+ * The provided gains are the default gains. The actual gain may depend on the temperature and the configuration of the Front End Module.
+ * See the Objective Product Specification for more details.
+ */
+
+/** Gain of the PA in dB. */
+#define MPSL_FEM_NRF21540_GPIO_PA_DEFAULT_GAIN_DB 20
+
+/** Gain of the LNA in dB. */
+#define MPSL_FEM_NRF21540_GPIO_LNA_DEFAULT_GAIN_DB 20
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MPSL_FEM_CONFIG_NRF21540_GPIO_H__
+
+/**@} */
diff --git a/mpsl/include/mpsl_fem_config_simple_gpio.h b/mpsl/include/mpsl_fem_config_simple_gpio.h
new file mode 100644
index 0000000000..d71943842b
--- /dev/null
+++ b/mpsl/include/mpsl_fem_config_simple_gpio.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2020 Nordic Semiconductor ASA
+ *
+ * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
+ */
+
+/**
+ * @file mpsl_fem_config_simple_gpio.h
+ *
+ * @defgroup mpsl_fem_simple_gpio MPSL Simple GPIO Front End Module Configuration
+ * @ingroup mpsl_fem
+ *
+ * The MPSL Simple GPIO Front End Module Configuration defines the configuration of the Simple GPIO Front End Module.
+ * @{
+ */
+
+#ifndef MPSL_FEM_CONFIG_SIMPLE_GPIO_H__
+#define MPSL_FEM_CONFIG_SIMPLE_GPIO_H__
+
+#include
+#include
+#include "mpsl_fem_config_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @brief Configuration parameters for the Front End Module Simple GPIO variant.
+ * A Simple GPIO Front End Module may be used with all Front End Modules which use one wire for PA and one wire for LNA.
+ */
+typedef struct
+{
+ struct
+ {
+ uint32_t pa_time_gap_us; /**< Time between the activation of the PA pin and the start of the radio transmission. Should be no bigger than Radio Ramp-Up time. */
+ uint32_t lna_time_gap_us; /**< Time between the activation of the LNA pin and the start of the radio reception. Should be no bigger than Radio Ramp-Up time. */
+ int8_t pa_gain_db; /**< Configurable PA gain. Ignored if the amplifier is not supporting this feature. */
+ int8_t lna_gain_db; /**< Configurable LNA gain. Ignored if the amplifier is not supporting this feature. */
+ } fem_config; /**< Configration structure of the Simple GPIO Front End Module. */
+
+ mpsl_fem_gpiote_pin_config_t pa_pin_config; /**< Power Amplifier pin configuration. */
+ mpsl_fem_gpiote_pin_config_t lna_pin_config; /**< Low Noise Amplifier pin configuration. */
+
+ uint8_t ppi_channels[2]; /**< Array of PPI which need to be provided to Front End Module to operate. */
+} mpsl_fem_simple_gpio_interface_config_t;
+
+/** @brief Configures the PA and LNA device interface.
+ *
+ * This function sets device interface parameters for the PA/LNA module.
+ * The module can then be used to control a power amplifier or a low noise amplifier (or both) through the given interface and resources.
+ *
+ * The function also sets the PPI and GPIOTE channels to be configured for the PA/LNA interface.
+ *
+ * @param[in] p_config Pointer to the interface parameters for the PA/LNA device.
+ *
+ * @retval 0 PA/LNA control successfully configured.
+ * @retval -NRF_EPERM PA/LNA is not available.
+ *
+ */
+int32_t mpsl_fem_simple_gpio_interface_config_set(mpsl_fem_simple_gpio_interface_config_t const * const p_config);
+
+/**
+ * Simple GPIO Front End Module Timings
+ *
+ * A Simple GPIO Front End Module may be used with all Front End Modules which use one wire for PA and one wire for LNA.
+ * The timing restrictions should be obtained from its corresponding datasheet.
+ */
+
+/** Time in microseconds when PA GPIO is activated before the radio is ready for transmission. */
+#define MPSL_FEM_SIMPLE_GPIO_DEFAULT_PA_TIME_IN_ADVANCE_US 23
+
+/** Time in microseconds when LNA GPIO is activated before the radio is ready for reception. */
+#define MPSL_FEM_SIMPLE_GPIO_DEFAULT_LNA_TIME_IN_ADVANCE_US 5
+
+/**
+ * Simple GPIO Front End Module Gains
+ *
+ * A Simple GPIO Front End Module may be used with all Front End Modules which use one wire for PA and one wire for LNA.
+ * The gains should be obtained from its corresponding datasheet.
+ */
+
+/** Gain of the PA in dB. */
+#define MPSL_FEM_SIMPLE_GPIO_PA_DEFAULT_GAIN_DB 22
+
+/** Gain of the LNA in dB. */
+#define MPSL_FEM_SIMPLE_GPIO_LNA_DEFAULT_GAIN_DB 11
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MPSL_FEM_CONFIG_SIMPLE_GPIO_H__
+
+/**@} */
diff --git a/mpsl/include/mpsl_fem_protocol_api.h b/mpsl/include/mpsl_fem_protocol_api.h
new file mode 100644
index 0000000000..9b51e9bc0d
--- /dev/null
+++ b/mpsl/include/mpsl_fem_protocol_api.h
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 2020 Nordic Semiconductor ASA
+ *
+ * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
+ */
+
+/**
+ * @file mpsl_fem_protocol_api.h
+ *
+ * @defgroup mpsl_fem MPSL Protocol interface for Power Amplifier (PA) and Low Noise Amplifier (LNA).
+ * @ingroup mpsl
+ *
+ * This module enables control of peripherals before and after the radio transmission and the radio reception
+ * in order to control a Power Amplifier or a Low Noise Amplifier, or both.
+ *
+ * The application must first provide PA and LNA device-specific configuration parameters to this module.
+ * The protocol must then provide PA and LNA protocol configuration parameters before it can use the functionality.
+ *
+ * When the PA/LNA module is configured, the stack can call the provided enable functions before radio activity
+ * to enable the PA or LNA timer configurations for the upcoming radio activity.
+ *
+ * @{
+ */
+
+#ifndef MPSL_FEM_PROTOCOL_API_H__
+#define MPSL_FEM_PROTOCOL_API_H__
+
+#include
+#include
+
+#include
+#include "nrf_errno.h"
+
+/** @brief PA and LNA functionality types.
+ */
+typedef enum
+{
+ MPSL_FEM_PA = 1 << 0, /**< PA Functionality. */
+ MPSL_FEM_LNA = 1 << 1, /**< LNA Functionality. */
+ MPSL_FEM_ALL = MPSL_FEM_PA | MPSL_FEM_LNA /**< Both PA and LNA Functionalities. */
+} mpsl_fem_functionality_t;
+
+/** @brief PA and LNA activation event types.
+ */
+typedef enum
+{
+ MPSL_FEM_EVENT_TYPE_TIMER, /**< Timer Event type. */
+ MPSL_FEM_EVENT_TYPE_GENERIC /**< Generic Event type. */
+} mpsl_fem_event_type_t;
+
+/** @brief MPSL Front End Module event. */
+typedef struct
+{
+ mpsl_fem_event_type_t type; /**< Type of event source. */
+ union
+ {
+ struct
+ {
+ NRF_TIMER_Type * p_timer_instance; /**< Pointer to a 1-us resolution timer instance. */
+ struct
+ {
+ uint32_t start; /**< Timer value when the Front End Module can start preparing PA/LNA. */
+ uint32_t end; /**< Timer value at which the PA/LNA have to be prepared. Radio operation shall start at this point. */
+ } counter_period; /**< Time interval in which the timer should start and end. */
+ uint8_t compare_channel_mask; /**< Mask of the compare channels that can be used by the Front End Module to schedule its own tasks. */
+ } timer; /**< Event generated by the timer, used in case of type equal to @ref mpsl_fem_event_type_t::MPSL_FEM_EVENT_TYPE_TIMER. */
+ struct
+ {
+ uint32_t register_address; /**< Address of event register. */
+ } generic; /**< Generic event, used in case of type equal to @ref mpsl_fem_event_type_t::MPSL_FEM_EVENT_TYPE_GENERIC. */
+ } event; /**< Implementation of the event. */
+ bool override_ppi; /**< False to ignore the PPI channel below and use the one set by application. True to use the PPI channel below. */
+ uint8_t ppi_ch_id; /**< PPI channel to be used for this event. */
+} mpsl_fem_event_t;
+
+/** @brief Sets up PA using the provided events for the upcoming radio transmission.
+ *
+ * Multiple configurations can be provided by repeating calls to this function (that is, you can set the activate and the deactivate events in multiple calls,
+ * and the configuration is preserved between calls).
+ *
+ * The order of calls of this function and its `lna` counterpart must match the order of radio operations.
+ * I.e. if you want to listen first and then send the frame, you need first to issue @ref mpsl_fem_lna_configuration_set and only after @ref mpsl_fem_pa_configuration_set.
+ *
+ * If a @ref mpsl_fem_event_type_t::MPSL_FEM_EVENT_TYPE_TIMER timer event is provided, the PA will be configured to activate or deactivate at the application-configured time gap
+ * before the timer instance reaches the given register_value. The time gap is set via the corresponding configuration setter of the selected Front End Module.
+ *
+ * If a @ref mpsl_fem_event_type_t::MPSL_FEM_EVENT_TYPE_GENERIC event is provided, the PA will be configured to activate or deactivate when an event occurs.
+ *
+ * The function sets up the PPIs and the GPIOTE channel to activate PA for the upcoming radio transmission.
+ * The PA pin will be active until deactivated, which can happen either by encountering a configured deactivation event or by using @ref mpsl_fem_deactivate_now.
+ *
+ * @param[in] p_activate_event Pointer to the activation event structure.
+ * @param[in] p_deactivate_event Pointer to the deactivation event structure.
+ *
+ * @pre To activate PA, the corresponding configuration setter of the selected Front End Module must have been called first.
+ *
+ * @note If a timer event is provided, the caller of this function is responsible for starting the timer and configuring its shorts.
+ * Moreover, the caller is responsible for stopping the timer no earlier than the compare channel of the lowest ID among the provided ones does expire.
+ *
+ * @note The activation event can be only of type @ref mpsl_fem_event_type_t::MPSL_FEM_EVENT_TYPE_TIMER. Using other activation event type leads to undefined module behavior.
+ *
+ * @retval 0 PA activation setup is successful.
+ * @retval -NRF_EPERM PA is currently disabled.
+ * @retval -NRF_EINVAL PA activation setup could not be performed due to invalid or missing configuration parameters
+ * in p_activate_event or p_deactivate_event, or both.
+ */
+int32_t mpsl_fem_pa_configuration_set(const mpsl_fem_event_t * const p_activate_event,
+ const mpsl_fem_event_t * const p_deactivate_event);
+
+/** @brief Clears up the configuration provided by the @ref mpsl_fem_pa_configuration_set function.
+ *
+ * @retval 0 PA activation setup purge is successful.
+ * @retval -NRF_EPERM PA is currently disabled.
+ */
+int32_t mpsl_fem_pa_configuration_clear(void);
+
+/** @brief Sets up LNA using the provided event for the upcoming radio reception.
+ *
+ * Multiple configurations can be provided by repeating calls to this function (that is, you can set the activate and the deactivate event in multiple calls,
+ * and the configuration is preserved between calls).
+ *
+ * The order of calls of this function and its `pa` counterpart must match the order of radio operations.
+ * I.e. if you want to listen first and then send the frame, you need first to issue @ref mpsl_fem_lna_configuration_set and only after @ref mpsl_fem_pa_configuration_set.
+ *
+ * If a @ref mpsl_fem_event_type_t::MPSL_FEM_EVENT_TYPE_TIMER timer event is provided, the LNA will be configured to activate or deactivate at the application-configured time gap
+ * before the timer instance reaches the given register_value. The time gap is set via the corresponding configuration setter of the selected Front End Module.
+ *
+ * If a @ref mpsl_fem_event_type_t::MPSL_FEM_EVENT_TYPE_GENERIC event is provided, the LNA will be configured to activate or deactivate when an event occurs.
+ *
+ * The function sets up the PPIs and the GPIOTE channel to activate LNA for the upcoming radio transmission.
+ * The LNA pin will be active until deactivated, which can happen either by encountering a configured deactivation event or by using @ref mpsl_fem_deactivate_now.
+ *
+ * @param[in] p_activate_event Pointer to the activation event structure.
+ * @param[in] p_deactivate_event Pointer to the deactivation event structure.
+ *
+ * @pre To activate LNA, the corresponding configuration setter of the selected Front End Module must have been called first.
+ *
+ * @note If a timer event is provided, the caller of this function is responsible for starting the timer and configuring its shorts.
+ * Moreover, the caller is responsible for stopping the timer no earlier than the compare channel of the lowest ID among the provided ones does expire.
+ *
+ * @note The activation event can be only of type @ref mpsl_fem_event_type_t::MPSL_FEM_EVENT_TYPE_TIMER. Using other activation event type leads to undefined module behavior.
+ *
+ * @retval 0 LNA activation setup is successful.
+ * @retval -NRF_EPERM LNA is currently disabled.
+ * @retval -NRF_EINVAL LNA activation setup could not be performed due to invalid or missing configuration parameters
+ * in p_activate_event or p_deactivate_event, or both.
+ */
+int32_t mpsl_fem_lna_configuration_set(const mpsl_fem_event_t * const p_activate_event,
+ const mpsl_fem_event_t * const p_deactivate_event);
+
+/** @brief Clears up the configuration provided by the @ref mpsl_fem_lna_configuration_set function.
+ *
+ *
+ * @retval 0 LNA activate setup purge is successful.
+ * @retval -NRF_EPERM LNA is currently disabled.
+ */
+int32_t mpsl_fem_lna_configuration_clear(void);
+
+/** @brief Deactivates PA/LNA with immediate effect - contrary to @ref mpsl_fem_lna_configuration_clear or @ref mpsl_fem_pa_configuration_clear,
+ * which both just set up the infrastructure for events which shall disable the PA/LNA.
+ *
+ * @param[in] type Whether to deactivate imeediately PA, LNA, or both (see @ref mpsl_fem_functionality_t).
+ */
+void mpsl_fem_deactivate_now(mpsl_fem_functionality_t type);
+
+/** @brief Instruct Front End Module to disable PA and LNA as soon as possible using the group following the event.
+ *
+ * @param[in] event Address of the event which is triggered when the abort condition occurs.
+ * @param[in] group PPI Group which shall be disabled when the abort event is triggered.
+ *
+ * @retval 0 Setting of the abort sequence path is successful.
+ * @retval -NRF_EPERM Setting of the abort sequence path could not be performed.
+ */
+int32_t mpsl_fem_abort_set(uint32_t event, uint32_t group);
+
+/** @brief Adds one more PPI channel to the PPI Group prepared by the @ref mpsl_fem_abort_set function.
+ *
+ * @param[in] channel_to_add PPI channel to add to the PPI group.
+ * @param[in] group The said PPI group.
+ *
+ * @retval 0 Setting of the abort sequence path is successful.
+ * @retval -NRF_EPERM Setting of the abort sequence path could not be performed.
+ */
+int32_t mpsl_fem_abort_extend(uint32_t channel_to_add, uint32_t group);
+
+/** @brief Removes one PPI channel from the PPI Group prepared by the @ref mpsl_fem_abort_set function.
+ *
+ * @param[in] channel_to_remove PPI channel to remove from the PPI group.
+ * @param[in] group The said PPI group.
+ *
+ * @retval 0 Setting of the abort sequence path is successful.
+ * @retval -NRF_EPERM Setting of the abort sequence path could not be performed.
+ */
+int32_t mpsl_fem_abort_reduce(uint32_t channel_to_remove, uint32_t group);
+
+/** @brief Clears up the configuration provided by the @ref mpsl_fem_abort_set function.
+ *
+ * @retval 0 Clearing of the abort sequence path is successful.
+ * @retval -NRF_EPERM Clearing was not done - the possible reason is that there was nothing to clear.
+ */
+int32_t mpsl_fem_abort_clear(void);
+
+/** @brief Cleans up the configured PA/LNA timer/radio instance and corresponding allocated hardware resources.
+ * The function resets the hardware that has been set up for the PA/LNA activation. The PA and LNA module control configuration parameters are not deleted.
+ * The function is intended to be called after the radio disable signal.
+ */
+void mpsl_fem_cleanup(void);
+
+/** @brief Checks if the PA signaling is configured and enabled, and gets the configured gain in dB.
+ *
+ * @param[out] p_gain The configured gain in dB if PA is configured and enabled.
+ * If there is no PA present or the PA does not affect the signal gain, returns 0 dB.
+ */
+void mpsl_fem_pa_is_configured(int8_t * const p_gain);
+
+/** @brief Prepares the Front End Module to switch to the Power Down state.
+ * The timer is owned by the protocol and must be started by the protocol.
+ * The timer stops after matching the provided compare channel (the call sets the short).
+ *
+ * @param[in] p_instance Timer instance that is used to schedule the transition to the Power Down state.
+ * @param[in] compare_channel Compare channel to hold a value for the timer.
+ * @param[in] ppi_id ID of the PPI channel used to switch to the Power Down state.
+ * @param[in] event_addr Address of the event which shall trigger the Timer start.
+ *
+ * @retval true Whether the scheduling of the transition was successful.
+ * @retval false Whether the scheduling of the transition was not successful.
+ */
+bool mpsl_fem_prepare_powerdown(NRF_TIMER_Type * p_instance,
+ uint32_t compare_channel,
+ uint32_t ppi_id,
+ uint32_t event_addr);
+
+#endif // MPSL_FEM_PROTOCOL_API_H__
+
+/**@} */
diff --git a/mpsl/lib/cortex-m33+nodsp/soft-float/libmpsl.a b/mpsl/lib/cortex-m33+nodsp/soft-float/libmpsl.a
index 18dd88c22f..4246d58ce0 100644
Binary files a/mpsl/lib/cortex-m33+nodsp/soft-float/libmpsl.a and b/mpsl/lib/cortex-m33+nodsp/soft-float/libmpsl.a differ
diff --git a/mpsl/lib/cortex-m33+nodsp/soft-float/manifest.yaml b/mpsl/lib/cortex-m33+nodsp/soft-float/manifest.yaml
index 8e5e161975..b15990e15f 100644
--- a/mpsl/lib/cortex-m33+nodsp/soft-float/manifest.yaml
+++ b/mpsl/lib/cortex-m33+nodsp/soft-float/manifest.yaml
@@ -1,3 +1,3 @@
description: Multi-Protocol Service Layer (MPSL)
-git_revision: 5adc4cd03489d50c51d4d4e078c170656efd1581
-timestamp: '2020-09-14T13:41:56Z'
+git_revision: 5ba0c131a3bb240f96ddef4e92db9f691e7d8431
+timestamp: '2020-09-21T10:39:02Z'
diff --git a/mpsl/lib/cortex-m4/hard-float/libmpsl.a b/mpsl/lib/cortex-m4/hard-float/libmpsl.a
index b0fa0272fe..e04e831df8 100644
Binary files a/mpsl/lib/cortex-m4/hard-float/libmpsl.a and b/mpsl/lib/cortex-m4/hard-float/libmpsl.a differ
diff --git a/mpsl/lib/cortex-m4/hard-float/manifest.yaml b/mpsl/lib/cortex-m4/hard-float/manifest.yaml
index 2e88c35d85..c866a2402d 100644
--- a/mpsl/lib/cortex-m4/hard-float/manifest.yaml
+++ b/mpsl/lib/cortex-m4/hard-float/manifest.yaml
@@ -1,3 +1,3 @@
description: Multi-Protocol Service Layer (MPSL)
-git_revision: 5adc4cd03489d50c51d4d4e078c170656efd1581
-timestamp: '2020-09-14T13:41:05Z'
+git_revision: 5ba0c131a3bb240f96ddef4e92db9f691e7d8431
+timestamp: '2020-09-21T10:38:59Z'
diff --git a/mpsl/lib/cortex-m4/soft-float/libmpsl.a b/mpsl/lib/cortex-m4/soft-float/libmpsl.a
index 7dc4016c2b..3a59503eb6 100644
Binary files a/mpsl/lib/cortex-m4/soft-float/libmpsl.a and b/mpsl/lib/cortex-m4/soft-float/libmpsl.a differ
diff --git a/mpsl/lib/cortex-m4/soft-float/manifest.yaml b/mpsl/lib/cortex-m4/soft-float/manifest.yaml
index 2e88c35d85..c866a2402d 100644
--- a/mpsl/lib/cortex-m4/soft-float/manifest.yaml
+++ b/mpsl/lib/cortex-m4/soft-float/manifest.yaml
@@ -1,3 +1,3 @@
description: Multi-Protocol Service Layer (MPSL)
-git_revision: 5adc4cd03489d50c51d4d4e078c170656efd1581
-timestamp: '2020-09-14T13:41:05Z'
+git_revision: 5ba0c131a3bb240f96ddef4e92db9f691e7d8431
+timestamp: '2020-09-21T10:38:59Z'
diff --git a/mpsl/lib/cortex-m4/softfp-float/libmpsl.a b/mpsl/lib/cortex-m4/softfp-float/libmpsl.a
index d1c9cf4332..48885fff29 100644
Binary files a/mpsl/lib/cortex-m4/softfp-float/libmpsl.a and b/mpsl/lib/cortex-m4/softfp-float/libmpsl.a differ
diff --git a/mpsl/lib/cortex-m4/softfp-float/manifest.yaml b/mpsl/lib/cortex-m4/softfp-float/manifest.yaml
index 2e88c35d85..c866a2402d 100644
--- a/mpsl/lib/cortex-m4/softfp-float/manifest.yaml
+++ b/mpsl/lib/cortex-m4/softfp-float/manifest.yaml
@@ -1,3 +1,3 @@
description: Multi-Protocol Service Layer (MPSL)
-git_revision: 5adc4cd03489d50c51d4d4e078c170656efd1581
-timestamp: '2020-09-14T13:41:05Z'
+git_revision: 5ba0c131a3bb240f96ddef4e92db9f691e7d8431
+timestamp: '2020-09-21T10:38:59Z'