diff --git a/arch/arm/src/samv7/sam_usbdevhs.c b/arch/arm/src/samv7/sam_usbdevhs.c index fd4e3d47ac8..cbb9503bb5f 100644 --- a/arch/arm/src/samv7/sam_usbdevhs.c +++ b/arch/arm/src/samv7/sam_usbdevhs.c @@ -1020,21 +1020,22 @@ static void sam_dma_wrsetup(struct sam_usbdev_s *priv, struct sam_ep_s *privep, if (remaining > DMA_MAX_FIFO_SIZE) { privreq->inflight = DMA_MAX_FIFO_SIZE; + privep->zlpneeded = false; } else #endif { privreq->inflight = remaining; + + /* If the size is an exact multple of full packets, then note if that + * we need to send a zero length packet next. + */ + + privep->zlpneeded = + ((privreq->req.flags & USBDEV_REQFLAGS_NULLPKT) != 0 && + (remaining % privep->ep.maxpacket) == 0); } - /* If the size is an exact multple of full packets, then note if that - * we need to send a zero length packet next. - */ - - privep->zlpneeded = - ((privreq->req.flags & USBDEV_REQFLAGS_NULLPKT) != 0 && - (remaining % privep->ep.maxpacket) == 0); - /* And perform the single DMA transfer. * * 32.6.10.6 Bulk IN or Interrupt IN: Sending a Buffer Using DMA