Skip to content

Commit 7f84fe9

Browse files
committed
dcd_nrf5x: Fix dcd_edpt_open for iso endpoint
When ISO endpoint handling was introduced two lines that clear stall and data toggle bit were left unchanged and they were effective for ISO enadpoint as well. This is incorrect behavior since EPSTALL and DTOGGLE registers have only 3 bits for address. Leaving code that clears toggle bit results in endpoint 0 toggle bit being reset when iso endpoint (8) is opened. Now code that clears stall and toggle bit is applied to non-iso endpoint only as it was done before iso handling was introduced.
1 parent b9be733 commit 7f84fe9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/portable/nordic/nrf5x/dcd_nrf5x.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,9 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt)
340340
NRF_USBD->INTENSET = TU_BIT(USBD_INTEN_ENDEPIN0_Pos + epnum);
341341
NRF_USBD->EPINEN |= TU_BIT(epnum);
342342
}
343+
// clear stall and reset DataToggle
344+
NRF_USBD->EPSTALL = (USBD_EPSTALL_STALL_UnStall << USBD_EPSTALL_STALL_Pos) | ep_addr;
345+
NRF_USBD->DTOGGLE = (USBD_DTOGGLE_VALUE_Data0 << USBD_DTOGGLE_VALUE_Pos) | ep_addr;
343346
}
344347
else
345348
{
@@ -375,10 +378,6 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt)
375378
}
376379
}
377380

378-
// clear stall and reset DataToggle
379-
NRF_USBD->EPSTALL = (USBD_EPSTALL_STALL_UnStall << USBD_EPSTALL_STALL_Pos) | ep_addr;
380-
NRF_USBD->DTOGGLE = (USBD_DTOGGLE_VALUE_Data0 << USBD_DTOGGLE_VALUE_Pos) | ep_addr;
381-
382381
__ISB(); __DSB();
383382

384383
return true;

0 commit comments

Comments
 (0)