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

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

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?
waclawek.jan
waclawek.janBest answer
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

3 replies

waclawek.jan
waclawek.janBest answer
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

cs_it
cs_itAuthor
Associate II
September 29, 2026

Thank you very much!

KDJEM.1
ST Technical Moderator
September 29, 2026

Hello ​@cs_it ;

 

Thank you for bringing this issue to our attention.

I reported internally for checking.

Internal ticket number CDM0066122 (This is an internal tracking number and is not accessible or usable by customers).

 

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.