2025-08-07 11:31 PM - edited 2025-08-07 11:36 PM
Hi ST,
I am successfully enabled the Audio through the SAI channel I am able to detect the card for our custom board. and using gst-play-1.0 this play the video and sound very well , also with aplay command.
But the thing is , whenever i use qtmultimedia, it's playing video very well , but sound not come.
when i connect the HDMI , then sound works through the card cs42l51. but when i disconnected the HDMI , and reboot the custom board , then i again i try to play video through the qtmultimedia with screenoff command then it play only video , but not given the audio output. Then i plugin the HDMI , then reboot the custom board , and i try to play the video through the qtmultimedia with screenoff command then sound works very well,
so i think the issues comes from the HDMI and cs42l51 card.
is something i am doing wrong from initialization and configuration
root@stm32mp255-customedsce-9b-60-e5-21-77:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: STM32MP25DK [STM32MP25-DK], device 0: 40290004.audio-controller-cs42l51-hifi cs42l51-hifi-0 [40290004.audio-controller-cs42l51-hifi cs42l51-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: STM32MP25DK [STM32MP25-DK], device 2: 400b0000.audio-controller-i2s-hifi i2s-hifi-2 [400b0000.audio-controller-i2s-hifi i2s-hifi-2]
Subdevices: 1/1
Subdevice #0: subdevice #0
root@stm32mp255-customedsce-9b-60-e5-21-77:~#
Solved! Go to Solution.
2025-08-11 2:17 AM
@asadullah4571 ,
Can you please just make the following test after the boot, and before your Qt application launch ?
MP2 $> systemd-run --collect -E XDG_SESSION_TYPE=wayland --uid=1000 -p PAMName=login -p TTYPath=/dev/tty7 sleep 1d
MP2 $> su -l weston -c "systemctl --user start pipewire"
MP2 $> su -l weston -c "systemctl --user start pipewire-pulse"
MP2 $> su -l weston -c "systemctl --user start wireplumber"
I do not know if all is needed, this is just to understand if we can configure manually something before your application launch.
Kind regards,
Erwan.
2025-08-08 2:30 AM
Hello @asadullah4571 ,
Would it be possible for you to share your complete DTS, as well as you pin configuration ?
If I well understand, it does work well with HDMI but not without, what is your display in the case where you do not have HDMI linked ? DSI / LVDS / RGB panel ?
Kind regards,
Erwan.
2025-08-08 4:08 AM
Hi @Erwan SZYMANSKI ,
Thank you for your quick response.
I have attached all the relevant DTS files for your reference.
To answer your question:
"What is your display in the case where you do not have HDMI linked? DSI / LVDS / RGB panel?"
We are not using any display in the production setup. The HDMI output was only used during development for verification purposes—to visually confirm that the Qt-based application UI is functioning as expected.
Our actual application is headless. Once validated, we run the Qt application using the screenoff command, and in the final production environment, neither HDMI nor any other display interface (DSI, LVDS, RGB) will be used.
Application summary.
The application receives video and image data over TCP.
It processes this data (splits it into multiple parts) and sends it out via TCP.
There is no need for any graphical display output.
However, audio output is required and critical to the application.
Currently, the application functions correctly without HDMI connected, and the TCP data processing and transmission work as expected.
The only remaining issue is that audio does not play when HDMI is disconnected.
Please let me know if there is anything specific that needs to be configured in the DTS or audio routing settings to enable audio output in a headless environment.
2025-08-08 5:07 AM
Hello @asadullah4571 ,
Thank you for the very complete summary, very clear.
As I thought that you had another display when not using HDMI, I wanted to double check that there was no pin conflict in one configuration, and not in the HDMI one, but this theory is now completely out of scope.
Anyway, let's continue on it.
I do not know the way you "launch" your video (that is in fact here just for the audio stream), but do you have some proof that the video is well launched and in a playback state ? Do you have some logs, portion of code to share or highlight ?
I just want to be sure that we really face an audio issue instead of a more general "video playback" issue without screen. I am not so familiar with Qt screenless to be completely transparent.
Kind regards,
Erwan.
2025-08-10 11:56 PM - edited 2025-08-11 12:04 AM
I can confirm that the video is launching correctly and is in a playback state.
As proof, I have logs captured during playback. The verification process was as follows:
I started video playback using the screenoff command (headless mode).
During playback, I took a snapshot of the video stream, split it into multiple parts, converted each part to RGB format, and sent them over different TCP ports.
On the client side, I received the RGB data, reconstructed the individual parts into full frames, and merged them to display the video.
This confirms that the video is indeed playing correctly without a display attached. and this device work as a mediator.
Note:
When using GStreamer (gst-play), video playback works correctly over HDMI, and audio is routed through I2S as expected.
When playing only audio without HDMI, using the aplay command, the CS42L51 codec (via SAI) is used successfully.
However, in Qt video playback:
With HDMI connected, video is displayed correctly, but audio is routed through SAI instead of I2S.
With HDMI disconnected, only the video plays; audio is not output at all.
Additionally, if HDMI is connected during boot, and then disconnected after the system has fully booted, subsequent video playback in Qt works correctly with audio output routed through SAI instead of I2S. This indicates that once HDMI is detected during boot, the audio configuration is established and remains functional through SAI even after HDMI is removed. So I think it's not from the QT side issue , I thing the issues with the configuration file side and may be from the pulseaudio configuration side.
However, audio playback fails with the following error:
For video playback, I am using the following PySide6 API:
2025-08-11 12:24 AM
Hello @asadullah4571 ,
Do you use our OpenSTLinux ecosystem in your own distribution ? I mean do you have the following folder present on your side on your target: /usr/local/weston-start-at-startup ?
We have different initialization script present by default on our side (such as audio.sh in this folder), and I think the audio configuration/init is dependent on the screen we detect after the boot at runtime.
As you said, when HDMI is plugged at boot time by default, the init script detect the HDMI as "connected" and launch a defined pulseaudio configuration. If not, I guess somewhere it tries to detect another panel/display, and maybe if it does not detect it, he just does not make the pulseaudio config at all.
I would advice you to take a look at it, and maybe hack or force manually the init script of pulseaudio.
Can you dig on this side and tell me if you can make it work ?
Kind regards,
Erwan.
2025-08-11 1:25 AM
Hi @Erwan SZYMANSKI
>>>>Do you use our OpenSTLinux ecosystem in your own distribution ?
YES
>>>I mean do you have the following folder present on your side on your target: /usr/local/weston-start-at-startup ?
YES
Note: if HDMI is not detected or any display not available, still it should be work , as show in this audio.sh script
if [ -f /usr/bin/pulseaudio_hdmi_switch.sh ]; then
/usr/bin/pulseaudio_hdmi_switch.sh
else
pactl info; pactl list sinks
I do not know how to bypass , how it work.
please let me know how can I start with this.
Here is terminal of the custom-board.
root@stm32mp255-customedsea-37-f8-14-34-c1:/usr/local/weston-start-at-startup# cat audio.sh
#!/bin/sh
source /etc/profile.d/pulse_profile.sh
# this magic line permit to create the link to pulseaudio
script -qc 'su -l weston -c "source /etc/profile.d/pulse_profile.sh;pactl info; pactl list sinks"'
while [ 1 ]; do
pactl info
if [ $? -eq 0 ]; then
break;
else
sleep 1;
fi
done
if [ -f /usr/bin/pulseaudio_hdmi_switch.sh ]; then
/usr/bin/pulseaudio_hdmi_switch.sh
else
pactl info; pactl list sinks
cards=`pactl list cards | grep -i 'api.alsa.card.name' | sed 's/ //g'| sed 's/api.alsa.card.name=\"//g'| sed 's/\"//g'`
index=0
for i in $cards;
do
found=`echo $i | grep -n STM32MP | wc -l`
if [ $found -eq 1 ];
then
index=$(echo \$i | sed 's/#//')
pactl set-card-profile $index output:analog-stereo
fi
index=$((index+1))
done
fi
# force pulseaudio sink and source to be on SUSPENDED state (cf: pactl list sinks)
pactl suspend-source 0
for sink in $(pactl list short sinks | awk '{ print $1 }'); do
pactl suspend-sink $sink
done
root@stm32mp255-customedsea-37-f8-14-34-c1:/usr/local/weston-start-at-startup#
2025-08-11 2:07 AM
Hello @asadullah4571 ,
I can confirm there is a dependency somewhere on the presence of display, that can be confirmed with this simple test on my side with evaluation board.
If I do not plug the default display, and make the pactl info command:
root@stm32mp2-e3-95-f9:~# pactl info
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
Now if I just plug the display and reboot:
root@stm32mp2-e3-95-f9:~# pactl info
Server String: unix:/run/user/1000/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 76
Tile Size: 65472
User Name: weston
Host Name: stm32mp2-e3-95-f9
Server Name: PulseAudio (on PipeWire 1.2.3)
Server Version: 15.0.0
Default Sample Specification: float32le 2ch 48000Hz
Default Channel Map: front-left,front-right
Default Sink: auto_null
Default Source: auto_null.monitor
Cookie: a35d:ffc9
I try to check in the distro File System where the choice is made.
Kind regards,
Erwan.
2025-08-11 2:17 AM
@asadullah4571 ,
Can you please just make the following test after the boot, and before your Qt application launch ?
MP2 $> systemd-run --collect -E XDG_SESSION_TYPE=wayland --uid=1000 -p PAMName=login -p TTYPath=/dev/tty7 sleep 1d
MP2 $> su -l weston -c "systemctl --user start pipewire"
MP2 $> su -l weston -c "systemctl --user start pipewire-pulse"
MP2 $> su -l weston -c "systemctl --user start wireplumber"
I do not know if all is needed, this is just to understand if we can configure manually something before your application launch.
Kind regards,
Erwan.
2025-08-11 4:53 AM
>>>>>>
Thank you — it is working well now.
However, I have observed that when I connect the HDMI cable, my Qt-based GUI application displays correctly on the HDMI screen, but the audio output continues to come from the SAI interface (cs42L51).
In contrast, when I play audio using gst-play, the sound is routed through the HDMI output as expected.