Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32F723 does not trigger HAL_PCD_DataOutStageCallback for USB Audio on Windows #8

Closed
fxtentacle opened this issue Jun 23, 2024 · 5 comments
Assignees
Labels
bug Something isn't working hal HAL-LL driver-related issue or pull-request. internal bug tracker Issue confirmed and logged into the internal bug tracking system usb Universal Serial Bus

Comments

@fxtentacle
Copy link

Dear STM team,

When I created a new STM32F723ZETx project (FW v1.17.2) with STM32CubeMx and selected USB audio, then it worked nicely on Linux, but AUDIO_PeriodicTC_HS was never called on Windows. I've verified that Windows is sending isochronous audio packets, which means the problem is caused by the STM32 HAL not triggering the appropriate callbacks despite the hardware receiving the data.

My impression is that this line:

https://github.com/STMicroelectronics/stm32f7xx_hal_driver/blob/52bfa97ba66afc08481f6fd7631322593bd89691/Src/stm32f7xx_hal_pcd.c#L1377

is trying to verify that the even/odd flag inside DOEPCTL is matching with the current frame number's parity. If that is the intention, then instead of

((RegVal & (0x1U << 16)) == (hpcd->FrameNumber & 0x1U)))

it should read

(((RegVal & (0x1U << 16)) != 0) == (hpcd->FrameNumber & 0x1U)))

because we want to check if the EONUM bit is set and not check for its absolute value. And, indeed, that small change repairs the HAL_PCD_DataOutStageCallback on Windows 😃

@ALABSTM ALABSTM self-assigned this Jun 24, 2024
@ALABSTM ALABSTM added bug Something isn't working hal HAL-LL driver-related issue or pull-request. usb Universal Serial Bus labels Jun 24, 2024
@ALABSTM
Copy link
Collaborator

ALABSTM commented Jun 24, 2024

Hi @fxtentacle,

Thank you for this report. The point looks valid. A question though please. After you changed the code in the hal_pcd.c file, did you try again on Linux to check everything is still OK?

With regards,

@fxtentacle
Copy link
Author

Yes, the change had no influence on Linux where the HAL_PCD_DataOutStageCallback was being called both before and afterwards. My subjective impression is that Linux now has a slightly improved timing from when I connect the STM32 until when the audio device changes, but that's really hard to measure objectively.

@ALABSTM
Copy link
Collaborator

ALABSTM commented Jun 28, 2024

ST Internal Reference: 185291

@ALABSTM ALABSTM added the internal bug tracker Issue confirmed and logged into the internal bug tracking system label Jun 28, 2024
@ALABSTM
Copy link
Collaborator

ALABSTM commented Jul 22, 2024

Hi @fxtentacle,

I hope you are doing well. Just to let you know that according to our development team, the fix should rather be as below, in order to check for both odd and even frames.

(((RegVal & (0x1U << 16)) >> 16) == (hpcd->FrameNumber & 0x1U)))

With regards,

@ALABSTM
Copy link
Collaborator

ALABSTM commented Jul 23, 2024

Fixed in commit c393a68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hal HAL-LL driver-related issue or pull-request. internal bug tracker Issue confirmed and logged into the internal bug tracking system usb Universal Serial Bus
Projects
Development

No branches or pull requests

2 participants