Showing results for 
Search instead for 
Did you mean: 

Where can I find official documentation on "USBx_DFIFO"?

Associate III

Hi. I'm looking at some code built for USB_FS communications on the STM32756-EVAL board.

HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src,
                                  uint8_t ch_ep_num, uint16_t len, uint8_t dma)
  uint32_t USBx_BASE = (uint32_t)USBx;
  uint8_t *pSrc = src;
  uint32_t count32b;
  uint32_t i;
  if (dma == 0U)
    count32b = ((uint32_t)len + 3U) / 4U;
    for (i = 0U; i < count32b; i++)
      USBx_DFIFO((uint32_t)ch_ep_num) = __UNALIGNED_UINT32_READ(pSrc);	//What is USBx_DFIFO((uint32_t)ch_ep_num)?
  return HAL_OK;

I am trying to understand what USBx_DFIFO is and have relied on the following documents.

  • PM0253 Programming manual - STM32F7 Series and STM32H7 Series Cortex®-M7 processor programming manual
  • UM1905 - Description of STM32F7 HAL and low-layer drivers - User manual
  • RM0385 - STM32F75xxx and STM32F74xxx advanced Arm®-based 32-bit MCUs - Reference manual

I have not found anything on USBx_DFIFO on these manuals. In that matter, I have not found anything on DFIFO either. The only place I was able to find any information was with OpenAI.

On the basis that OpenAI had to have gotten this information from somewhere, I was wondering where I could find documentation on USBx_DFIFO is.

ST Employee

Hello @OIp.1​ ,

Please refer to RM0385 and precisely 37.11 USB data FIFOs Section and 37.14 OTG_FS/OTG_HS control and status registers Section.

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Thank you.


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.

USBx_DFIFO() is obviously either a function or a macro. Now many IDEs will point you to its definition, but it's enough to use a textual search on the libraries you are using, in your case obviously CubeF7.

#define USBx_DFIFO(i)   *(__IO uint32_t *)(USBx_BASE + USB_OTG_FIFO_BASE + ((i) * USB_OTG_FIFO_SIZE))

of which USBx_BASE is a variable defined at the beginning of given function and assigned pointer (i.e. address of) OTG module through function parameters; USB_OTG_FIFO_BASE and USB_OTG_FIFO_SIZE are constant macros defined in the MSIS-mandated device header, both as 0x1000.

In other words, this macro returns address which is offset from address of the given OTG module by (0x1000 + 0x1000 * number-of-endpoint). And that is the address of FIFO for given endpoint:


While Kaouthar gave you pointers to subchapters, you ought to read the entire OTG chapter in RM for further understanding of FIFO's role in this module. USB is complex, and the OTG module is very comples. FIFO usage is quite tricky and the steps given in the usage subchapter have to be obeyed. Note, that FIFO is word-aligned, word-accessed-only; the entire 0x1000 area (each word in it) in fact is one single "window" register through which data are pushed/pulled to/from FIFO; and that every register which is used to determine FIFO's assigned size is in words.

You are not forced to use Cube. There are 3rd party USB stacks out there, and you can also write your own.