Skip to content

Commit 348e3a7

Browse files
authored
NRF5: Fix ESB deadlock (#1445)
1 parent 8857ef7 commit 348e3a7

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,17 +179,6 @@ 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-
}
193182

194183
// Enable interrupt
195184
NRF5_RADIO_TIMER->INTENSET = TIMER_INTENSET_COMPARE1_Enabled << TIMER_INTENSET_COMPARE1_Pos;
@@ -350,7 +339,6 @@ void NRF5_ESB_starttx()
350339
NRF_RADIO->SHORTS = NRF5_ESB_SHORTS_TX;
351340

352341
// reset timer
353-
NRF_RESET_EVENT(NRF5_RADIO_TIMER->EVENTS_COMPARE[3]);
354342
_stopTimer();
355343
NRF5_RADIO_TIMER->TASKS_CLEAR = 1;
356344
// Set retransmit time
@@ -528,6 +516,19 @@ inline void _stopTimer()
528516
NRF5_RADIO_TIMER->TASKS_STOP = 1;
529517
// NRF52 PAN#78
530518
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+
531532
}
532533

533534
inline void _stopACK()
@@ -697,7 +698,6 @@ extern "C" {
697698
{
698699
if (NRF5_RADIO_TIMER->EVENTS_COMPARE[3] == 1) {
699700
_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)