Skip to main content
ABasi.2
Senior
Oct 12, 2026 8:32 PM UTC
Question

problem with STM32H563zi USBX audio class

Hi

i’m triyng to use USBX audio class on nucleo-h563zi.

 

i have succed to make PC to recognise the board like a controller audio but windows have problem to start the device (error code 10), problem 0xA status:  0xC0440027

i’m stuck at this fase unfortunately

 

also i think there are some missing files in the middleware directory, in the example provided by ST UX_Device_Audio2.0_Playback 

(not sure is related to the error to start device)

there is this code: 

VOID USBD_AUDIO_PlaybackStreamChange(UX_DEVICE_CLASS_AUDIO_STREAM *audio_play_stream,
ULONG alternate_setting)
{
/* USER CODE BEGIN USBD_AUDIO_PlaybackStreamChange */

/* Do nothing if alternate setting is 0 (stream closed). */
if (alternate_setting == 0)
{
return;
}

BufferCtl.state = PLAY_BUFFER_OFFSET_UNKNOWN;

/* Start reception (stream opened). */
ux_device_class_audio_reception_start(audio_play_stream);

/* USER CODE END USBD_AUDIO_PlaybackStreamChange */

return;
}

the function ux_device_class_audio_reception_start(audio_play_stream);

is located in ux_device_class_audio_reception_start.c

that i’m not able to find in the files generated by cube MX for my project

 

any idea?

 

best reguards!

6 replies

ST Technical Moderator
Oct 22, 2026 12:42 PM UTC

Hi ​@ABasi.2 

I’m not sure if we delivered examples for USBX audio on H5, can you point me directly to the example you are using. Otherwise share minimal project to reproduce the issue you are seeing. 

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
ABasi.2
ABasi.2Author
Senior
Oct 22, 2026 6:54 PM UTC

Hi ​@FBL 

thank you for your response

 

the example that i’m using to understand the USB Audio is Ux_Device_Audio2.0_Playback , written for nucleo-H743

the first issue is that to use the function ux_device_class_audio_reception_start(audio_play_stream) the file ux_device_class_audio_reception_start.c is missing, cube MX don’t generate it, i have to copy that file from the example.

but the real issue is:

now i’m able to make my board (NUCLEO-H563ZI) enumerate like a Audio device on windows, but as soon i try to send some audio to it ( i open youtube and select from windows the device to use to reproduce the sound) the board goes in HardFault.

almost always the list of function called before the hardfault are:

_tx_ts_restore()

_tx_ipsr_get()

_tx_thread_system_return_inline()

_tx_thread_system_suspend()

 

i attach my entire project, my goal for now is to be able to receive the audio packet (using a printf to ensure a correctly receive), after this step i will pass the audio pachet to a audio chip.

thank you in advance

best reguards

 

 

ST Technical Moderator
Oct 23, 2026 1:54 PM UTC

Hi ​@ABasi.2 

Thank you for reporting the issue regarding code generation. I will let my colleague ​@Mahmoud Ben Romdhane  manage it.

Regarding ThreadX functions you listed are scheduler and thread suspension routines nd seeing them before a HF does not by itself identify the cause. The fault may occur while a thread is being suspended or resumed ...

Don’t call printf directly from an interrupt or a time critical USB callback. Copy the received bytes and length into a buffer or queue, then print them from a separate ThreadX thread. 

To start, USBD_AUDIO_ControlProcess() receives audio_instance, but currently calls USBX with the global audio pointer

status = ux_device_class_audio20_control_process(audio_instance, transfer, &group);

 

 

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
ABasi.2
ABasi.2Author
Senior
Oct 23, 2026 5:21 PM UTC

hi ​@FBL 

 

it seems to me there is some memory issue or something like that

 

actually we didn’t arrive to call printf, it crash before.

 

it seems to crash when the firse packet arrive, but i don’t understand why.

 

what modification are you suggesting about status = ux_device_class_audio20_control_process(audio_instance, transfer, &group); ?

did you already check my files?

 

thank you in advance 

 

best reguards

 

 

ST Technical Moderator
Oct 27, 2026 9:11 AM UTC

 Hi ​@ABasi.2 

First, I found that ux_device_class_audio20_control_process was pointing to audio pointer instead of audio_instance

Second, capture the faulting PC, LR, SP, CFSR, HFSR, and the debugger call stack. Those are needed to distinguish a bad pointer or stack problem from a USB transfer configuration issue.

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
ABasi.2
ABasi.2Author
Senior
Oct 27, 2026 8:40 PM UTC

hello ​@FBL 

i have found the bug that caused the hardfault, 

UX_SLAVE_REQUEST_DATA_MAX_LENGTH was set to 64 byte, but for my descriptor should be >= of 192 byte,

i made it 512 byte and now the issue is resolved, i can receive Audio packet without problem.

 

there is one more think but its more difficult to replicate, it happened that when i switched on windows from my board to normal headphone the output of sound it went to hard fault, but it happended only two times, i’m trying to replicate to investigate the problem.

 

where i can find the ux_device_class_audio_reception_start.c file of release 6.4.0 like the other files?

the copied file ( i remember to you that cube MX don’t create this file anda i have to copy from the example) is of a previous relese.

 

now i’m developing the circular buffer ecc to send the audio packet to the audio chip.

 

i attach to this post the new project that now can receive the Audio packet without hard fault

 

thank you!

 

best reguards