cancel
Showing results for 
Search instead for 
Did you mean: 

How do I clear my output buffer?

AFidi.1
Associate II

I'm using an STM32F103C8T6 "Blue Pill" connected to Ublox module using UART. It just a simple operation of receiving data and then print them to serial monitor using CDC_Transmit()

HAL_UART_Receive(&huart1, receivedData, sizeof receivedData, HAL_MAX_DELAY);
while(CDC_Transmit_FS(receivedData, sizeof receivedData)== USBD_BUSY);

The weird thing is it still transmitting data even though I unplugged all the wire where it should be transmitting nothing. I'm thinking its still printing the previous output buffer. If it is the case how can I clear my buffer?

1 REPLY 1

Perhaps check for error/status returns? Although I'd assume the max delay is like 49 days

Toggle an LED?

Snippet doesn't provide much context.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..