Skip to content

Commit be15499

Browse files
maje-embjukkar
authored andcommitted
esb: Fix timer configuration
Corrected the timer configuration for the nRF54 series. Replaced the deprecated TASKS_SHUTDOWN in the nRF52 series with TASKS_STOP and TASKS_CLEAR, following the approach used for the nRF54 series. Added clearing of timer before counting the ACK wait time and retransmission time. Ref: NCSDK-30802 Signed-off-by: Marcin Jelinski <[email protected]>
1 parent 1affd25 commit be15499

File tree

2 files changed

+7
-27
lines changed

2 files changed

+7
-27
lines changed

subsys/esb/esb.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,8 @@ static void esb_fem_for_tx_ack(void)
445445

446446
static void esb_fem_reset(void)
447447
{
448-
#if defined(TIMER_TASKS_SHUTDOWN_TASKS_SHUTDOWN_Msk)
449-
nrf_timer_task_trigger(esb_timer.p_reg, NRF_TIMER_TASK_SHUTDOWN);
450-
#else
451448
nrf_timer_task_trigger(esb_timer.p_reg, NRF_TIMER_TASK_STOP);
452-
#endif
449+
nrf_timer_task_trigger(esb_timer.p_reg, NRF_TIMER_TASK_CLEAR);
453450

454451
mpsl_fem_lna_configuration_clear();
455452
mpsl_fem_pa_configuration_clear();
@@ -462,11 +459,8 @@ static void esb_fem_reset(void)
462459

463460
static void esb_fem_lna_reset(void)
464461
{
465-
#if defined(TIMER_TASKS_SHUTDOWN_TASKS_SHUTDOWN_Msk)
466-
nrf_timer_task_trigger(esb_timer.p_reg, NRF_TIMER_TASK_SHUTDOWN);
467-
#else
468462
nrf_timer_task_trigger(esb_timer.p_reg, NRF_TIMER_TASK_STOP);
469-
#endif
463+
nrf_timer_task_trigger(esb_timer.p_reg, NRF_TIMER_TASK_CLEAR);
470464

471465
esb_ppi_for_fem_clear();
472466

@@ -478,11 +472,9 @@ static void esb_fem_pa_reset(void)
478472
{
479473
mpsl_fem_pa_configuration_clear();
480474

481-
#if defined(TIMER_TASKS_SHUTDOWN_TASKS_SHUTDOWN_Msk)
482-
nrf_timer_task_trigger(esb_timer.p_reg, NRF_TIMER_TASK_SHUTDOWN);
483-
#else
484475
nrf_timer_task_trigger(esb_timer.p_reg, NRF_TIMER_TASK_STOP);
485-
#endif
476+
nrf_timer_task_trigger(esb_timer.p_reg, NRF_TIMER_TASK_CLEAR);
477+
486478
esb_ppi_for_fem_clear();
487479

488480
mpsl_fem_disable();
@@ -1236,6 +1228,7 @@ static void on_radio_disabled_tx(void)
12361228
* received by the time defined in wait_for_ack_timeout_us
12371229
*/
12381230

1231+
nrf_timer_task_trigger(esb_timer.p_reg, NRF_TIMER_TASK_CLEAR);
12391232
nrfx_timer_compare(&esb_timer, NRF_TIMER_CC_CHANNEL0,
12401233
(wait_for_ack_timeout_us + ADDR_EVENT_LATENCY_US), false);
12411234

@@ -1301,11 +1294,8 @@ static void on_radio_disabled_tx_wait_for_ack(void)
13011294
}
13021295
} else {
13031296
if (retransmits_remaining-- == 0) {
1304-
#if defined(TIMER_TASKS_SHUTDOWN_TASKS_SHUTDOWN_Msk)
1305-
nrf_timer_task_trigger(esb_timer.p_reg, NRF_TIMER_TASK_SHUTDOWN);
1306-
#else
13071297
nrf_timer_task_trigger(esb_timer.p_reg, NRF_TIMER_TASK_STOP);
1308-
#endif
1298+
nrf_timer_task_trigger(esb_timer.p_reg, NRF_TIMER_TASK_CLEAR);
13091299

13101300
/* All retransmits are expended, and the TX operation is
13111301
* suspended

subsys/esb/esb_dppi.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,8 @@ void esb_ppi_for_wait_for_ack_set(void)
150150
nrf_timer_publish_set(ESB_NRF_TIMER_INSTANCE, NRF_TIMER_EVENT_COMPARE0,
151151
timer_compare0_radio_disable);
152152

153-
#if defined(TIMER_TASKS_SHUTDOWN_TASKS_SHUTDOWN_Msk)
154-
nrf_timer_subscribe_set(ESB_NRF_TIMER_INSTANCE, NRF_TIMER_TASK_SHUTDOWN,
155-
radio_address_timer_stop);
156-
#else
157153
nrf_timer_subscribe_set(ESB_NRF_TIMER_INSTANCE, NRF_TIMER_TASK_STOP,
158154
radio_address_timer_stop);
159-
#endif
160155

161156
nrf_radio_subscribe_set(NRF_RADIO, NRF_RADIO_TASK_DISABLE, timer_compare0_radio_disable);
162157

@@ -178,12 +173,7 @@ void esb_ppi_for_wait_for_ack_clear(void)
178173
nrf_radio_publish_clear(NRF_RADIO, NRF_RADIO_EVENT_ADDRESS);
179174
nrf_timer_publish_clear(ESB_NRF_TIMER_INSTANCE, NRF_TIMER_EVENT_COMPARE0);
180175

181-
#if defined(TIMER_TASKS_SHUTDOWN_TASKS_SHUTDOWN_Msk)
182-
nrf_timer_subscribe_clear(ESB_NRF_TIMER_INSTANCE, NRF_TIMER_TASK_SHUTDOWN);
183-
#else
184-
nrf_timer_subscribe_set(ESB_NRF_TIMER_INSTANCE, NRF_TIMER_TASK_STOP,
185-
radio_address_timer_stop);
186-
#endif
176+
nrf_timer_subscribe_clear(ESB_NRF_TIMER_INSTANCE, NRF_TIMER_TASK_STOP);
187177

188178
nrf_radio_subscribe_clear(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
189179
}

0 commit comments

Comments
 (0)