Skip to main content
cs_it
Associate II
May 16, 2026
Question

Wrong code in stm32f4xx_ll_usb.c line 2004

  • May 16, 2026
  • 3 replies
  • 118 views

Hello,

In this file, the line:

USBx_HC((uint32_t)ch_num)->HCSPLT |= USB_OTG_HCSPLT_XACTPOS_Pos;

wrongly alters bits 1 to 3 of register HCSPLT

That can be fixed simply by removing this line, since middle payload is encoded by bits 00 in the XACTPOS field.

 

3 replies

Pavel A.
Super User
May 16, 2026

Link to the source:

https://github.com/STMicroelectronics/stm32f4xx-hal-driver/blob/61d71646b8e8d7ff76404fbbc95f03d38bcaa938/Src/stm32f4xx_ll_usb.c#L2004

Do you mean that these bits should not be touched after assignment to HCSPLT in line 1972 ?

 

Exactly same code for STM32H7 , here,   here

Exactly same code for STM32H5,  here.

Possibly in other MCUs too.

@mƎALLEm 

 

 

cs_it
cs_itAuthor
Associate II
May 17, 2026

Yes, it's what I think. The coding style here is to set appropriate bits to one in the XACTPOS field, and all XACTPOS bits are zero for middle payload.

Technical Moderator
May 18, 2026

Hi @cs_it 

I assume middle payload must be encoded as 00 as described in register description fields

An internal ticket CDM0062710   is submitted to dedicated team to report this potential bug.

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.Best regards,FBL