From 319e499b680fb04b15dbd1334aa1e4f5443eadc0 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Fri, 23 Apr 2021 18:53:36 -0700 Subject: [PATCH] add fix so that if it's busy we wait and try again... --- stm32/usb/usbd_cdc_if.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/stm32/usb/usbd_cdc_if.c b/stm32/usb/usbd_cdc_if.c index d8f498c..2b390f4 100755 --- a/stm32/usb/usbd_cdc_if.c +++ b/stm32/usb/usbd_cdc_if.c @@ -315,7 +315,13 @@ void usb_printf(const char *format, ...) va_start(args, format); length = vsnprintf((char *)UserTxBufferFS, APP_TX_DATA_SIZE, (char *)format, args); va_end(args); - CDC_Transmit_FS(UserTxBufferFS, length); + for (;;) { + if (CDC_Transmit_FS(UserTxBufferFS, length) == USBD_BUSY) { + HAL_Delay(1); + continue; + } + break; + } } /* USER CODE END PRIVATE_FUNCTIONS_IMPLEMENTATION */