Skip to content

Commit 8f1f8ad

Browse files
authored
Revert "NRF5: Fix ESB deadlock (#1445)" (#1448)
This reverts commit 348e3a7.
1 parent 348e3a7 commit 8f1f8ad

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

hal/transport/NRF5_ESB/driver/Radio_ESB.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,17 @@ static bool NRF5_ESB_initialize()
179179
// Stop timer when CC0 reached
180180
NRF5_RADIO_TIMER->SHORTS =
181181
TIMER_SHORTS_COMPARE3_CLEAR_Msk | TIMER_SHORTS_COMPARE3_STOP_Msk;
182+
// Reset timer
183+
NRF5_RADIO_TIMER->TASKS_CLEAR = 1;
184+
185+
// Reset compare events
186+
#ifdef NRF51
187+
for (uint8_t i=0; i<4; i++) {
188+
#else
189+
for (uint8_t i=0; i<6; i++) {
190+
#endif
191+
NRF5_RADIO_TIMER->EVENTS_COMPARE[i] = 0;
192+
}
182193

183194
// Enable interrupt
184195
NRF5_RADIO_TIMER->INTENSET = TIMER_INTENSET_COMPARE1_Enabled << TIMER_INTENSET_COMPARE1_Pos;
@@ -339,6 +350,7 @@ void NRF5_ESB_starttx()
339350
NRF_RADIO->SHORTS = NRF5_ESB_SHORTS_TX;
340351

341352
// reset timer
353+
NRF_RESET_EVENT(NRF5_RADIO_TIMER->EVENTS_COMPARE[3]);
342354
_stopTimer();
343355
NRF5_RADIO_TIMER->TASKS_CLEAR = 1;
344356
// Set retransmit time
@@ -516,19 +528,6 @@ inline void _stopTimer()
516528
NRF5_RADIO_TIMER->TASKS_STOP = 1;
517529
// NRF52 PAN#78
518530
NRF5_RADIO_TIMER->TASKS_SHUTDOWN = 1;
519-
520-
// Reset timer
521-
NRF5_RADIO_TIMER->TASKS_CLEAR = 1;
522-
523-
// Reset compare events
524-
#ifdef NRF51
525-
for (uint8_t i=0; i<4; i++) {
526-
#else
527-
for (uint8_t i=0; i<6; i++) {
528-
#endif
529-
NRF5_RADIO_TIMER->EVENTS_COMPARE[i] = 0;
530-
}
531-
532531
}
533532

534533
inline void _stopACK()
@@ -698,6 +697,7 @@ extern "C" {
698697
{
699698
if (NRF5_RADIO_TIMER->EVENTS_COMPARE[3] == 1) {
700699
_stopTimer();
700+
NRF_RESET_EVENT(NRF5_RADIO_TIMER->EVENTS_COMPARE[1]);
701701
if (ack_received == false) {
702702
// missing ACK, start TX again
703703
NRF5_ESB_starttx();

0 commit comments

Comments
 (0)