Skip to content

Commit 3a4215b

Browse files
maje-embnordicjm
authored andcommitted
esb: Fix timer shorts configuration for CONFIG_ESB_NEVER_DISABLE_TX
This change fixes the configuration of timer shorts for CONFIG_ESB_NEVER_DISABLE_TX mode. Ref: NCSDK-32394 Signed-off-by: Marcin Jelinski <[email protected]>
1 parent 3fac5fa commit 3a4215b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

doc/nrf/protocols/esb/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,3 +338,5 @@ It changes the ESB driver's behavior.
338338
If a packet is not acknowledged, the radio peripheral remains in TXIDLE state instead of TXDISABLE when transmission is pending.
339339
Using this experimental feature can reduce transmission delay below 100 µs for a 32 bits (four bytes) payload.
340340
However, this process consumes more energy, because the radio transmitter stage remains enabled when transmission is taking place.
341+
In this mode, the :c:member:`esb_config.retransmit_delay` field specifies the delay between consecutive packet transmissions from the TX FIFO.
342+
Depending on the reception processing time, a minimum value might be required.

subsys/esb/esb.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,16 @@ static void esb_fem_for_tx_set(bool ack)
420420
nrf_timer_cc_set(esb_timer.p_reg, NRF_TIMER_CC_CHANNEL2, ramp_up);
421421
}
422422

423+
if (IS_ENABLED(CONFIG_ESB_NEVER_DISABLE_TX)) {
424+
uint32_t cc1 = nrfx_timer_capture_get(&esb_timer, NRF_TIMER_CC_CHANNEL1);
425+
uint32_t cc2 = nrfx_timer_capture_get(&esb_timer, NRF_TIMER_CC_CHANNEL2);
426+
427+
if (cc1 > cc2) {
428+
timer_shorts = NRF_TIMER_SHORT_COMPARE1_STOP_MASK;
429+
timer_shorts |= NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK;
430+
}
431+
}
432+
423433
nrf_timer_shorts_set(esb_timer.p_reg, timer_shorts);
424434
}
425435

0 commit comments

Comments
 (0)