From 917fd51057da6f3afd2260990012b6566156c61e Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 29 Aug 2019 23:23:58 -0400 Subject: stm32: Discard usbotg tx data until usb is ready If the usb interface is not ready, just discard messages. Signed-off-by: Kevin O'Connor --- src/stm32/usbotg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/stm32/usbotg.c b/src/stm32/usbotg.c index 99837a09..e1c880fb 100644 --- a/src/stm32/usbotg.c +++ b/src/stm32/usbotg.c @@ -160,8 +160,8 @@ usb_send_bulk_in(void *data, uint_fast8_t len) { uint32_t ctl = EPIN(USB_CDC_EP_BULK_IN)->DIEPCTL; if (!(ctl & USB_OTG_DIEPCTL_USBAEP)) - // Controller not enabled - return -2; + // Controller not enabled - discard data + return len; if (ctl & USB_OTG_DIEPCTL_EPENA) { // Wait for space to transmit OTGD->DIEPEMPMSK |= (1 << USB_CDC_EP_BULK_IN); -- cgit v1.2.3-70-g09d2