Skip to main content
cs_it
Associate II
September 29, 2026
Question

OTG HS DIEPCTLx_MPSIZ: Contradiction between RM0090 documentation and code in stm32f4xx_ll_usb.c

  • September 29, 2026
  • 1 reply
  • 10 views

In the RM0090 manual, for the OTG_HS, the MPSIZ field definition is the same for all enpoints:

 

Note: this is not the case for OTG_FS where endpoint 0 has a specific format for field MPSIZ.

 

However, the code in file stm32f4xx_ll_usb.c sets this field to 0 in order to set the maximum packet size to 64 byte.

See lines 1355 and 1356:

  /* Set the MPS of the IN EP0 to 64 bytes */
USBx_INEP(0U)->DIEPCTL &= ~USB_OTG_DIEPCTL_MPSIZ;

It is OK with the OFG_FS definition on DIEPCTL0_MPSIZ but not with the OTG_HS definition.

My question is: what should be done here:

  • setting 0 in MPSIZ, like the code does or
  • setting 64 in MPSIZ as specified in the RM0090 documentation?

1 reply

waclawek.jan
Super User
September 29, 2026

Nice catch!

I’ve just confirmed experimentally, that OTG_HS_DIEPCTL0 has implemented only 2 bits of MPSIZ, exactly as OTG_FS_DIEPCTL0 has. IMO, this is simply RM0090 documentation bug and the HS EP0 DIEPCTL MPSIZ is “special” in the same way as in FS, i.e. 0b00 → 64 bytes.

JW