diff --git a/arch/arm/src/efm32/efm32_usbhost.c b/arch/arm/src/efm32/efm32_usbhost.c index 0192ad07cc..3db5c8d434 100644 --- a/arch/arm/src/efm32/efm32_usbhost.c +++ b/arch/arm/src/efm32/efm32_usbhost.c @@ -2177,6 +2177,7 @@ static ssize_t efm32_out_transfer(FAR struct efm32_usbhost_s *priv, int chidx, size_t xfrlen; ssize_t xfrd; int ret; + bool zlp; /* Loop until the transfer completes (i.e., buflen is decremented to zero) * or a fatal error occurs (any error other than a simple NAK) @@ -2185,8 +2186,9 @@ static ssize_t efm32_out_transfer(FAR struct efm32_usbhost_s *priv, int chidx, chan = &priv->chan[chidx]; start = clock_systimer(); xfrd = 0; + zlp = (buflen == 0); - while (buflen > 0) + while (buflen > 0 || zlp) { /* Transfer one packet at a time. The hardware is capable of queueing * multiple OUT packets, but I just haven't figured out how to handle @@ -2263,6 +2265,7 @@ static ssize_t efm32_out_transfer(FAR struct efm32_usbhost_s *priv, int chidx, buffer += xfrlen; buflen -= xfrlen; xfrd += chan->xfrd; + zlp = false; } }