Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions nrf_802154/common/include/nrf_802154.h
Original file line number Diff line number Diff line change
Expand Up @@ -801,8 +801,8 @@ void nrf_802154_promiscuous_set(bool enabled);
/**
* @brief Checks if the radio is in the promiscuous mode.
*
* @retval True Radio is in the promiscuous mode.
* @retval False Radio is not in the promiscuous mode.
* @retval true Radio is in the promiscuous mode.
* @retval false Radio is not in the promiscuous mode.
*/
bool nrf_802154_promiscuous_get(void);

Expand Down Expand Up @@ -833,8 +833,8 @@ void nrf_802154_auto_ack_set(bool enabled);
/**
* @brief Checks if the auto ACK is enabled.
*
* @retval True Auto ACK is enabled.
* @retval False Auto ACK is disabled.
* @retval true Auto ACK is enabled.
* @retval false Auto ACK is disabled.
*/
bool nrf_802154_auto_ack_get(void);

Expand Down Expand Up @@ -926,8 +926,8 @@ void nrf_802154_src_addr_matching_method_set(nrf_802154_src_addr_match_t match_m
* @param[in] length Length of @p p_data.
* @param[in] data_type Type of data to be set. Refer to the @ref nrf_802154_ack_data_t type.
*
* @retval True Address successfully added to the list.
* @retval False Not enough memory to store this address in the list.
* @retval true Address successfully added to the list.
* @retval false Not enough memory to store this address in the list.
*/
bool nrf_802154_ack_data_set(const uint8_t * p_addr,
bool extended,
Expand All @@ -953,8 +953,8 @@ bool nrf_802154_ack_data_set(const uint8_t * p_addr,
* @param[in] extended If the given address is an extended MAC address or a short MAC address.
* @param[in] data_type Type of data to be removed. Refer to the @ref nrf_802154_ack_data_t type.
*
* @retval True Address removed from the list.
* @retval False Address not found in the list.
* @retval true Address removed from the list.
* @retval false Address not found in the list.
*/
bool nrf_802154_ack_data_clear(const uint8_t * p_addr,
bool extended,
Expand Down Expand Up @@ -1007,8 +1007,8 @@ void nrf_802154_auto_pending_bit_set(bool enabled);
* @param[in] p_addr Array of bytes containing the address of the node (little-endian).
* @param[in] extended If the given address is an extended MAC address or a short MAC address.
*
* @retval True The address is successfully added to the list.
* @retval False Not enough memory to store the address in the list.
* @retval true The address is successfully added to the list.
* @retval false Not enough memory to store the address in the list.
*/
bool nrf_802154_pending_bit_for_addr_set(const uint8_t * p_addr, bool extended);

Expand All @@ -1027,8 +1027,8 @@ bool nrf_802154_pending_bit_for_addr_set(const uint8_t * p_addr, bool extended);
* @param[in] p_addr Array of bytes containing the address of the node (little-endian).
* @param[in] extended If the given address is an extended MAC address or a short MAC address.
*
* @retval True The address is successfully removed from the list.
* @retval False No such address in the list.
* @retval true The address is successfully removed from the list.
* @retval false No such address in the list.
*/
bool nrf_802154_pending_bit_for_addr_clear(const uint8_t * p_addr, bool extended);

Expand Down Expand Up @@ -1533,6 +1533,23 @@ void nrf_802154_cst_writer_period_set(uint16_t period);
*/
void nrf_802154_cst_writer_anchor_time_set(uint64_t anchor_time);

/**
* @brief Returns if the radio has PA modulation fix enabled.
*
* @retval true PA modulation fix is enabled.
* @retval false PA modulation fix is disabled.
*/
bool nrf_802154_pa_modulation_fix_get(void);

/**
* @brief Enables or disables the PA modulation fix.
*
* @note The PA modulation fix is enabled by default on the chips that require it.
*
* @param[in] enabled If the PA modulation fix is to be enabled.
*/
void nrf_802154_pa_modulation_fix_set(bool enable);

/**
* @}
* @defgroup nrf_802154_test_modes Test modes
Expand Down
6 changes: 6 additions & 0 deletions nrf_802154/doc/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ Added
* Added a TX diagnostic mode that permits sending arbitrary data payloads.
Enable this feature with the :c:macro:`NRF_802154_TX_DIAGNOSTIC_MODE` configuration macro.
When enabled, the driver must be built with reduced functionality. (KRKNWK-20784)
* Added support for controlling the PA modulation fix at runtime. (KRKNWK-21006)

The fix is enabled by default on all SoCs that require it.
You can use the :c:func:`nrf_802154_pa_modulation_fix_set` function to enable or disable the fix at runtime.

On SoCs that do not require the fix, enabling it has no effect.

nRF Connect SDK v3.1.0 - nRF 802.15.4 Radio Driver
**************************************************
Expand Down
11 changes: 11 additions & 0 deletions nrf_802154/driver/src/nrf_802154.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include "nrf_802154_pib.h"
#include "nrf_802154_request.h"
#include "nrf_802154_rx_buffer.h"
#include "nrf_802154_trx.h"
#include "nrf_802154_tx_power.h"
#include "nrf_802154_stats.h"
#include "nrf_802154_swi.h"
Expand Down Expand Up @@ -628,6 +629,16 @@ void nrf_802154_promiscuous_set(bool enabled)
nrf_802154_pib_promiscuous_set(enabled);
}

bool nrf_802154_pa_modulation_fix_get(void)
{
return nrf_802154_trx_pa_modulation_fix_get();
}

void nrf_802154_pa_modulation_fix_set(bool enable)
{
nrf_802154_trx_pa_modulation_fix_set(enable);
}

void nrf_802154_rx_on_when_idle_set(bool enabled)
{
nrf_802154_pib_rx_on_when_idle_set(enabled);
Expand Down
45 changes: 35 additions & 10 deletions nrf_802154/driver/src/nrf_802154_trx.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ void nrf_802154_radio_irq_handler(void); ///< Prototype required by internal RAD
#define NRF_802154_TRX_TEST_MODE_ALLOW_LATE_TX_ACK 0
#endif

#if !defined(CONFIG_SOC_SERIES_BSIM_NRFXX) && (defined(NRF5340_XXAA) || \
NRF54L_CONFIGURATION_56_ENABLE)
#define NRF_802154_TRX_PA_MODULATION_FIX
#endif

#if !defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
/// System Clock Frequency (Core Clock) provided by nrfx.
extern uint32_t SystemCoreClock;
Expand Down Expand Up @@ -243,6 +248,10 @@ static volatile uint32_t m_timer_value_on_radio_end_event;
static volatile bool m_transmit_with_cca;
static volatile uint8_t m_remaining_cca_attempts;

#if defined(NRF_802154_TRX_PA_MODULATION_FIX)
static bool m_pa_modulation_fix_enabled = true;
#endif /* NRF_802154_TRX_PA_MODULATION_FIX */

static void timer_frequency_set_1mhz(void);

static void rxframe_finish_disable_ppis(void);
Expand Down Expand Up @@ -803,31 +812,26 @@ static void pa_modulation_fix_apply(bool enable)
volatile uint32_t * p_radio_reg;

#if defined(NRF5340_XXAA)
#define PA_MOD_FILTER_VALUE 0x40081B08
p_radio_reg = (volatile uint32_t *)(RADIO_BASE + 0x584UL);
#elif NRF54L_CONFIGURATION_56_ENABLE
#elif NRF54L_CONFIGURATION_56_ENABLE /* MLTPAN-56 */
#define PA_MOD_FILTER_VALUE 0x01280001ul
p_radio_reg = (volatile uint32_t *)(RADIO_BASE + 0x8C4UL);
#else
#error Unknown SoC
#endif

if (enable)
if (enable && m_pa_modulation_fix_enabled)
{
mpsl_fem_caps_t fem_caps = {};

mpsl_fem_caps_get(&fem_caps);

if ((fem_caps.flags & MPSL_FEM_CAPS_FLAG_PA_SETUP_REQUIRED) != 0)
{
#if defined(NRF5340_XXAA)
m_pa_mod_filter_latched = *(p_radio_reg);
m_pa_mod_filter_is_latched = true;
*(p_radio_reg) = 0x40081B08;
#elif NRF54L_CONFIGURATION_56_ENABLE
// MLTPAN-56
m_pa_mod_filter_latched = *(p_radio_reg);
m_pa_mod_filter_is_latched = true;
*(p_radio_reg) = 0x01280001ul;
#endif
*(p_radio_reg) = PA_MOD_FILTER_VALUE;
}
}
else if (m_pa_mod_filter_is_latched)
Expand All @@ -841,12 +845,33 @@ static void pa_modulation_fix_apply(bool enable)
#endif /* !defined(CONFIG_SOC_SERIES_BSIM_NRFXX) */
}

void nrf_802154_trx_pa_modulation_fix_set(bool enable)
{
#if defined(NRF_802154_TRX_PA_MODULATION_FIX)
m_pa_modulation_fix_enabled = enable;
#else
(void)enable;
#endif /* NRF_802154_TRX_PA_MODULATION_FIX */
}

bool nrf_802154_trx_pa_modulation_fix_get(void)
{
#if defined(NRF_802154_TRX_PA_MODULATION_FIX)
return m_pa_modulation_fix_enabled;
#else
return false;
#endif /* NRF_802154_TRX_PA_MODULATION_FIX */
}

void nrf_802154_trx_module_reset(void)
{
m_trx_state = TRX_STATE_DISABLED;
m_timer_value_on_radio_end_event = 0;
m_transmit_with_cca = false;
mp_receive_buffer = NULL;
#if defined(NRF_802154_TRX_PA_MODULATION_FIX)
m_pa_modulation_fix_enabled = true;
#endif /* NRF_802154_TRX_PA_MODULATION_FIX */

memset(&m_flags, 0, sizeof(m_flags));
}
Expand Down
17 changes: 17 additions & 0 deletions nrf_802154/driver/src/nrf_802154_trx.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,23 @@ void nrf_802154_trx_enable(void);
*/
void nrf_802154_trx_disable(void);

/**
* @brief Returns if the radio has PA modulation fix enabled.
*
* @retval True PA modulation fix is enabled.
* @retval False PA modulation fix is disabled.
*/
bool nrf_802154_trx_pa_modulation_fix_get(void);

/**
* @brief Enables or disables the PA modulation fix.
*
* @note The PA modulation fix is enabled by default on the chips that require it.
*
* @param[in] enabled If the PA modulation fix is to be enabled.
*/
void nrf_802154_trx_pa_modulation_fix_set(bool enable);

/**
* @brief Updates currently used antenna.
*
Expand Down