2025-10-30 12:17 PM
This branches off from the second question I asked in here.
Using the example code (Ux_Device_Audio2.0_PlayBack) right off the bat does not work, and this is what I've done so far.
@FBL also suggested an approach, which I will test tomorrow:
I implemented a double-buffering approach where we clear (zero out) one half of the SAI audio buffer while writing to the other half, then swap the operation accordingly. This ensures that old audio data is removed before new data is processed, minimizing unwanted noise. It works on my end ! Add between /* USER CODE BEGIN 1 */ and /* USER CODE END1 */
uint32_t half = AUDIO_TOTAL_BUF_SIZE/2;
void BSP_AUDIO_OUT_HalfTransfer_CallBack(uint32_t Instance)
{
memset(&BufferCtl.buff[0], 0, AUDIO_TOTAL_BUF_SIZE/2);
}
void BSP_AUDIO_OUT_TransferComplete_CallBack(uint32_t Instance)
{
memset(&BufferCtl.buff[AUDIO_TOTAL_BUF_SIZE/2], 0, AUDIO_TOTAL_BUF_SIZE/2);
}
2025-10-31 3:05 AM
Hi @audio
Great news! I assume, to zero out the audio buffer halves during DMA callbacks is a good for this looping issues caused by stale data. Combined with proper USB endpoint management by enabling UX_DEVICE_CLASS_AUDIO_FEEDBACK_SUPPORT in ux_user.h, this should resolve the playback looping.
If you are hearing different types of noise, it is possible that multiple distinct issues are contributing, each requiring specific attention to resolve effectively.
An internal ticket is submitted to dedicated team to enhance examples on N6 (supporting RTOS + standalone ) and on H7 to avoid noise (220884) .
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.
2025-10-31 7:31 AM
Hello @FBL
After implementing your approach, it is interesting to see where that block can be placed.
Not sure why this happens.
This is after removing the BSP_AUDIO_OUT_Stop(0) as I mentioned in the post, because of the screeching. Your approach does remove the looping, but it is not stable.
Regardless though, any player I use, it still hangs for about 10 seconds before replaying again. So something is going on in the background for sure, and I still believe it's the USB endpoint issue. Still investigating.
As your comment about UX_DEVICE_CLASS_AUDIO_FEEDBACK_SUPPORT in ux_user.h, unfortunately I do not see this in my project. I do see that it is used in many #if defined directive in few files, but no ux_user.h.
2025-10-31 8:09 AM
Hello @audio
Thank you for your feedback !
First, it seems, you missed my comment in the original thread! I quote : Add between /* USER CODE BEGIN 1 */ and /* USER CODE END1 */ in ux_device_audio_play.c. Maybe half should be volatile, to avoid optimization by compiler.
Second, after forwarding your request to development team, I have the confirmation, Feedback support will be provided soon in upcoming release of CubeN6.
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.
2025-10-31 8:59 AM - edited 2025-10-31 8:59 AM
2025-11-03 2:46 AM
Hi @audio
Now, I got your point. I meant you should implement it in here.
Regarding STM32CubeN6, the examples provided there will include support for the Feedback endpoint, which helps eliminate the "tick" noise issue you did not mention.
I will keep you updated on any new releases or relevant information here as soon as it becomes available.
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.
2025-11-03 6:40 AM
Hello @FBL
Thanks for letting me know about the STM32CubeN6.
Any way you can also push this update to STM32CubeH7 or even in x-cube-azrtos-h7?
As of this time of writing, the STM32CubeH7 has an application for USB Audio card (Audio_Standalone is the project name), however it is for UAC1.0 rather than UAC2.0 and there's no support for HS (high speed).
This is why I am using the software package from x-cube-azrtos-h7.
While I have you on here, can you please look at AN4879, and in Table 4, you'll see that STM32H753 line does not have the C or D checked. This is misleading as one of the main reasons why I bought STM32H753 is that it supports USB HS to support many audio channels. Can you confirm if that's a mistake?
2025-11-03 9:58 AM - edited 2025-11-06 7:45 AM
Hi @audio
Indeed, it should be implemented in x cube azrtos h7 as well !
About Table4, STM32H753 should have B and C checked. You can refer to Table 6. USB implementation on STM32 high-performance products, you can find both USB OTG controllers supported.
An internal ticket is submitted to dedicated team to update AN4879 table 4 (221053).
About x-cube-azrtos-h7 planning, as of now, we don't have visibility on this!
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.
2025-11-03 10:02 AM
Appreciate!
Do we know the expected time to get a response for the x-cube-azrtos-h7 update?
2025-11-07 10:36 AM
I just wanted to confirm 3 things here, hoping that's what's been sent to the team.
As we mentioned before, your snippet did solve 1 and 2, but it is not stable, it would cut in and out or distort in some playbacks. It does not solve 3.