summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/stm32
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-05-29 10:26:00 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-05-29 10:26:00 -0600
commit26346bebfa749b55d1dd983c478d14c913eb9619 (patch)
treed8c42f6585bfb31af497f7100b09b3b2f9274bf8 /nuttx/arch/arm/src/stm32
parentc2f92bd1abeb2cab6b1dffb6f88f10b6c8b596e1 (diff)
downloadpx4-nuttx-26346bebfa749b55d1dd983c478d14c913eb9619.tar.gz
px4-nuttx-26346bebfa749b55d1dd983c478d14c913eb9619.tar.bz2
px4-nuttx-26346bebfa749b55d1dd983c478d14c913eb9619.zip
Fix STM32F1 and F3 USB device driver. It was not handling NULL packets correctly and it prevent use of the driver with the CDC/ACM class
Diffstat (limited to 'nuttx/arch/arm/src/stm32')
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_usbdev.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_usbdev.c b/nuttx/arch/arm/src/stm32/stm32_usbdev.c
index ab3967783..d35e707c3 100644
--- a/nuttx/arch/arm/src/stm32/stm32_usbdev.c
+++ b/nuttx/arch/arm/src/stm32/stm32_usbdev.c
@@ -1253,7 +1253,16 @@ static int stm32_wrrequest(struct stm32_usbdev_s *priv, struct stm32_ep_s *prive
#warning "REVISIT: If the EP supports double buffering, then we can do better"
- /* Send the next packet */
+ /* Either (1) we are committed to sending the null packet (because txnullpkt == 1
+ * && nbytes == 0), or (2) we have not yet send the last packet (nbytes > 0).
+ * In either case, it is appropriate to clearn txnullpkt now.
+ */
+
+ privep->txnullpkt = 0;
+
+ /* If we are not sending a NULL packet, then clip the size to maxpacket
+ * and check if we need to send a following NULL packet.
+ */
if (nbytes > 0)
{
@@ -1261,7 +1270,6 @@ static int stm32_wrrequest(struct stm32_usbdev_s *priv, struct stm32_ep_s *prive
* the request.
*/
- privep->txnullpkt = 0;
if (nbytes >= privep->ep.maxpacket)
{
nbytes = privep->ep.maxpacket;