Skip to main content
AFidi.1
Associate II
December 7, 2022
Question

How do I clear my output buffer?

  • December 7, 2022
  • 1 reply
  • 730 views

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?

This topic has been closed for replies.

1 reply

Tesla DeLorean
Guru
December 7, 2022

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 VenmoUp vote any posts that you find helpful, it shows what's working..