Skip to content

Commit 65e60f3

Browse files
authored
Merge pull request #2463 from kasjer/kasjer/nrf5x-isoout-corruption-detection
nrf5x: Handle ISOOUT CRC errors
2 parents 09589a6 + 68bb858 commit 65e60f3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/portable/nordic/nrf5x/dcd_nrf5x.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,11 @@ void dcd_int_handler(uint8_t rhport)
653653
if (NRF_USBD->EPOUTEN & USBD_EPOUTEN_ISOOUT_Msk)
654654
{
655655
iso_enabled = true;
656-
xact_out_dma(EP_ISO_NUM);
656+
// Transfer from endpoint to RAM only if data is not corrupted
657+
if ((int_status & USBD_INTEN_USBEVENT_Msk) == 0 ||
658+
(NRF_USBD->EVENTCAUSE & USBD_EVENTCAUSE_ISOOUTCRC_Msk) == 0) {
659+
xact_out_dma(EP_ISO_NUM);
660+
}
657661
}
658662

659663
// ISOIN: Notify client that data was transferred
@@ -683,7 +687,7 @@ void dcd_int_handler(uint8_t rhport)
683687
{
684688
TU_LOG(2, "EVENTCAUSE = 0x%04lX\r\n", NRF_USBD->EVENTCAUSE);
685689

686-
enum { EVT_CAUSE_MASK = USBD_EVENTCAUSE_SUSPEND_Msk | USBD_EVENTCAUSE_RESUME_Msk | USBD_EVENTCAUSE_USBWUALLOWED_Msk };
690+
enum { EVT_CAUSE_MASK = USBD_EVENTCAUSE_SUSPEND_Msk | USBD_EVENTCAUSE_RESUME_Msk | USBD_EVENTCAUSE_USBWUALLOWED_Msk | USBD_EVENTCAUSE_ISOOUTCRC_Msk };
687691
uint32_t const evt_cause = NRF_USBD->EVENTCAUSE & EVT_CAUSE_MASK;
688692
NRF_USBD->EVENTCAUSE = evt_cause; // clear interrupt
689693

0 commit comments

Comments
 (0)