summaryrefslogtreecommitdiff
path: root/src/portable
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-03-08 14:20:28 +0700
committerhathach <[email protected]>2020-03-08 14:20:28 +0700
commitc8247f0907040eb86c301e8bff8bb322fc9cb566 (patch)
treeaac811533cd4615d8fb95ad7614c17fcf82742d8 /src/portable
parent7aa5a53652270a06dc60e6293393755350bf7c85 (diff)
fix zlp for nrf52840
Diffstat (limited to 'src/portable')
-rw-r--r--src/portable/nordic/nrf5x/dcd_nrf5x.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/portable/nordic/nrf5x/dcd_nrf5x.c b/src/portable/nordic/nrf5x/dcd_nrf5x.c
index 59c2f36aa..2ce288d6c 100644
--- a/src/portable/nordic/nrf5x/dcd_nrf5x.c
+++ b/src/portable/nordic/nrf5x/dcd_nrf5x.c
@@ -276,8 +276,10 @@ bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
xfer->total_len = total_bytes;
xfer->actual_len = 0;
- // Control endpoint with zero-length packet --> status stage
- if ( epnum == 0 && total_bytes == 0 )
+ // Control endpoint with zero-length packet and opposite direction to 1st request byte --> status stage
+ bool const control_status = (epnum == 0 && total_bytes == 0 && dir != tu_edpt_dir(NRF_USBD->BMREQUESTTYPE));
+
+ if ( control_status )
{
// Status Phase also require Easy DMA has to be free as well !!!!
edpt_dma_start(&NRF_USBD->TASKS_EP0STATUS);