2025-03-12 2:37 AM - last edited on 2025-03-12 2:42 AM by mƎALLEm
Hello All,
Need your support regarding flushing of RX FIFO buffer in STM32H747.I am using a barcode reader which is connected to USB HS port . And i want to clear the received data from the buffer at particular instance. And after that instance want to read the buffer again. Can anyone please suggest how can i do it.
I have tried multiple method ,and i have mentioned all of them below:-
1. Using Inbuild function in STM32 USB Library file.
USB_FlushRxFifo(hhcd_USB_OTG_HS.Instance);
2.Masking the RXFLVLM bit from GINTMSK Register.
hhcd_USB_OTG_HS.Instance->GINTMSK &=~ ((0x1UL << (4U)));
3.Disabling the GINTMSK bit in GAHBCFG Register
hhcd_USB_OTG_HS.Instance->GAHBCFG &=~ ((0x1UL << (0U)));
4. Setting Core soft reset bit in GRSTCTL
hhcd_USB_OTG_HS.Instance->GRSTCTL |= USB_OTG_GRSTCTL_CSRST;
5. Deiniting & initing the USB device using inbuild functions from STM32.
USBH_DeInit(&hUSBHostHS);
USBH_Init(&hUSBHostHS, HID_USBH_UserProcess, HOST_HS);
the only method which worked was method 5 but it is taking longer than expected duration.
Can any body suggest is there any other way to Flush the RX fifo Buffer.
2025-06-16 11:32 AM
Hi @Rushali
First, core soft reset bit in GRSTCTL is read only.
Timeout value could be redefined based on your system's clock speed.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.