[nrf528xx] update nRF IEEE 802.15.4 Radio Driver to version 1.6.1 (#4390)

This commit is contained in:
Duda, Lukasz
2019-12-10 10:16:33 -08:00
committed by Jonathan Hui
parent a52d80e475
commit a08a9ceee3
4 changed files with 35 additions and 16 deletions
@@ -117,7 +117,7 @@ typedef struct
/** Mask of GPIOTE channels used for FEM control. */
#define NRF_802154_FEM_GPIOTE_CHANNELS_USED_MASK ( \
(1 << NRF_FEM_CONTROL_DEAFULT_LNA_GPIOTE_CHANNEL) | \
(1 << NRF_FEM_CONTROL_DEFAULT_LNA_GPIOTE_CHANNEL) | \
(1 << NRF_FEM_CONTROL_DEFAULT_PA_GPIOTE_CHANNEL))
#ifdef __cplusplus
@@ -261,12 +261,13 @@ static int32_t event_configuration_set(const nrf_802154_fal_event_t * const p_ev
p_event->event.timer.compare_channel_mask,
1);
nrf_ppi_channel_endpoint_setup(m_nrf_fem_interface_config.ppi_ch_id_pdn,
(uint32_t)(&(p_event->event.timer.p_timer_instance->
EVENTS_COMPARE[compare_channel])),
pdn_task_addr);
nrf_ppi_channel_endpoint_setup(
(nrf_ppi_channel_t)m_nrf_fem_interface_config.ppi_ch_id_pdn,
(uint32_t)(&(p_event->event.timer.p_timer_instance->
EVENTS_COMPARE[compare_channel])),
pdn_task_addr);
nrf_ppi_channel_enable(m_nrf_fem_interface_config.ppi_ch_id_pdn);
nrf_ppi_channel_enable((nrf_ppi_channel_t)m_nrf_fem_interface_config.ppi_ch_id_pdn);
nrf_timer_cc_write(p_event->event.timer.p_timer_instance,
(nrf_timer_cc_channel_t)compare_channel,
@@ -552,9 +553,9 @@ bool nrf_fem_prepare_powerdown(NRF_TIMER_Type * p_instance,
}
nrf_timer_cc_write(p_instance,
compare_channel,
(nrf_timer_cc_channel_t)compare_channel,
m_nrf_fem_interface_config.fem_config.trx_hold_us + 1);
nrf_ppi_channel_endpoint_setup(m_nrf_fem_interface_config.ppi_ch_id_pdn,
nrf_ppi_channel_endpoint_setup((nrf_ppi_channel_t)m_nrf_fem_interface_config.ppi_ch_id_pdn,
(uint32_t)(&(p_instance->EVENTS_COMPARE[compare_channel])),
pdn_task_addr);
@@ -638,7 +638,7 @@ static void irq_deinit(void)
static void nrf_timer_init(void)
{
nrf_timer_mode_set(NRF_802154_TIMER_INSTANCE, NRF_TIMER_MODE_TIMER);
nrf_timer_bit_width_set(NRF_802154_TIMER_INSTANCE, NRF_TIMER_BIT_WIDTH_16);
nrf_timer_bit_width_set(NRF_802154_TIMER_INSTANCE, NRF_TIMER_BIT_WIDTH_32);
nrf_timer_frequency_set(NRF_802154_TIMER_INSTANCE, NRF_TIMER_FREQ_1MHz);
#if NRF_802154_DISABLE_BCC_MATCHING
@@ -1042,6 +1042,8 @@ static void rx_terminate(void)
nrf_ppi_channel_disable(PPI_CRCOK_DIS_PPI);
nrf_ppi_channel_disable(PPI_ADDRESS_COUNTER_COUNT);
nrf_ppi_channel_disable(PPI_CRCERROR_COUNTER_CLEAR);
nrf_ppi_channel_endpoint_setup(PPI_CRCERROR_CLEAR, 0, 0);
nrf_ppi_fork_endpoint_setup(PPI_CRCERROR_CLEAR, 0);
#endif // NRF_802154_DISABLE_BCC_MATCHING
// Disable LNA
@@ -1106,6 +1108,8 @@ static void tx_ack_terminate(void)
#if NRF_802154_DISABLE_BCC_MATCHING
nrf_ppi_channel_disable(PPI_CRCERROR_CLEAR);
nrf_ppi_channel_disable(PPI_CRCOK_DIS_PPI);
nrf_ppi_channel_endpoint_setup(PPI_CRCERROR_CLEAR, 0, 0);
nrf_ppi_fork_endpoint_setup(PPI_CRCERROR_CLEAR, 0);
#endif // NRF_802154_DISABLE_BCC_MATCHING
// Disable PA
@@ -2178,19 +2182,29 @@ static void irq_crcok_state_rx(void)
#endif // !NRF_802154_DISABLE_BCC_MATCHING
// Set FEM PPIs
uint32_t time_to_pa = nrf_timer_cc_read(NRF_802154_TIMER_INSTANCE,
NRF_TIMER_CC_CHANNEL1);
uint32_t time_to_rampup = nrf_timer_cc_read(NRF_802154_TIMER_INSTANCE,
NRF_TIMER_CC_CHANNEL1);
nrf_802154_fal_event_t timer = m_activate_tx_cc0;
timer.event.timer.counter_value += time_to_pa;
timer.event.timer.counter_value += time_to_rampup;
nrf_802154_fal_pa_configuration_set(&timer, NULL);
// Detect if PPI worked (timer is counting or TIMER event is marked)
nrf_timer_task_trigger(NRF_802154_TIMER_INSTANCE, NRF_TIMER_TASK_CAPTURE3);
if (nrf_timer_cc_read(NRF_802154_TIMER_INSTANCE, NRF_TIMER_CC_CHANNEL3) <
nrf_timer_cc_read(NRF_802154_TIMER_INSTANCE, NRF_TIMER_CC_CHANNEL1))
uint32_t current_timer_value = nrf_timer_cc_read(NRF_802154_TIMER_INSTANCE,
NRF_TIMER_CC_CHANNEL3);
uint32_t time_to_fem = nrf_timer_cc_read(NRF_802154_TIMER_INSTANCE,
NRF_TIMER_CC_CHANNEL0);
// When external PA uses timer, it should be configured to a time later than ramp up
// time. In such case, the timer stops with shorts on PA timer.
// But if external PA does not use timer, FEM time is set to a value in the pased
// used by LNA. After timer overflow, the timer stops with short on the past value
// used by LNA. We have to detect if the timer is after the overflow.
if ((current_timer_value < time_to_rampup) &&
((time_to_fem >= time_to_rampup) || (current_timer_value > time_to_fem)))
{
wait_for_phyend = true;
}
@@ -2242,6 +2256,8 @@ static void irq_crcok_state_rx(void)
#if !NRF_802154_DISABLE_BCC_MATCHING
nrf_ppi_channel_disable(PPI_TIMER_TX_ACK);
nrf_ppi_channel_endpoint_setup(PPI_TIMER_TX_ACK, 0, 0);
nrf_ppi_fork_endpoint_setup(PPI_TIMER_TX_ACK, 0);
#endif // !NRF_802154_DISABLE_BCC_MATCHING
// RX uses the same peripherals as TX_ACK until RADIO ints are updated.
@@ -2372,7 +2388,9 @@ static void irq_phyend_state_tx_ack(void)
NRF_TIMER_TASK_START));
#else // NRF_802154_DISABLE_BCC_MATCHING
nrf_ppi_channel_disable(PPI_TIMER_TX_ACK);
#endif // NRF_802154_DISABLE_BCC_MATCHING
nrf_ppi_channel_endpoint_setup(PPI_TIMER_TX_ACK, 0, 0);
nrf_ppi_fork_endpoint_setup(PPI_TIMER_TX_ACK, 0);
#endif // NRF_802154_DISABLE_BCC_MATCHING
// Enable PPI disabled by CRCOK
nrf_ppi_channel_enable(PPI_EGU_RAMP_UP);
@@ -492,7 +492,7 @@ extern "C" {
#ifdef NRF_802154_FRAME_TIMESTAMP_ENABLED
#define NRF_802154_PPI_GROUPS_USED_MASK ((1 << NRF_802154_PPI_CORE_GROUP) | \
(1 << NRF_802154_PPI_TIMESTAMP_GROUP)
(1 << NRF_802154_PPI_TIMESTAMP_GROUP))
#else // NRF_802154_FRAME_TIMESTAMP_ENABLED
#define NRF_802154_PPI_GROUPS_USED_MASK (1 << NRF_802154_PPI_CORE_GROUP)
#endif // NRF_802154_FRAME_TIMESTAMP_ENABLED