[HDMI] Sound glitch every 3 sec

Post Reply
Mobilaz
Posts: 6
Joined: Tue Oct 30, 2018 8:00 pm
languages_spoken: english
ODROIDs: ODROID-C2
Has thanked: 0
Been thanked: 0
Contact:

[HDMI] Sound glitch every 3 sec

Unread post by Mobilaz » Tue Oct 30, 2018 9:46 pm

Hi,

For my project, I would like to display a video with sound via HDMI with an Odroid-C2 and the ubuntu distribution based on the kernel 3.16.60.
I noticed that every 3 seconds there is a small glitch corresponding to a drop of an audio sample when playing a sine wave at 200Hz.

This issue seems to not appear when using the LibreElec distribution.

After investigation, I think that the issue comes from a drift between the audio clock and the hdmi clock but I couldn't find any clock differences between the Ubuntu and the LibreElec distribution.

I also noticed a lot of differences between the two sound drivers from LibreElec and Ubuntu (in /sound/soc/aml/m8 mainly).

Do you have any idea why there is a sound glitch or/and how I could use the same clock for the audio/hdmi system as in LibreElec ?

Thanks in advance

User avatar
rooted
Posts: 6450
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 4 times
Been thanked: 4 times
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by rooted » Wed Oct 31, 2018 2:21 am

You could try using LE kernel.

User avatar
odroid
Site Admin
Posts: 30288
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 3 times
Been thanked: 26 times
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by odroid » Wed Oct 31, 2018 9:39 am

Can you share the 200Hz sine wave audio file to reproduce the issue on our side?

Mobilaz
Posts: 6
Joined: Tue Oct 30, 2018 8:00 pm
languages_spoken: english
ODROIDs: ODROID-C2
Has thanked: 0
Been thanked: 0
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by Mobilaz » Wed Oct 31, 2018 8:28 pm

Hi,

Thanks for your reply.

I used the ALSA Api to send an homemade sine wave at 200Hz to the HDMI.

Please find hereby attached the source code of the sinewave and the elf file.

In the device tree, I could see that the PLL0 is used in ubuntu while the PLL2 is used in LE kernel for I2S. Is it possible that this has an impact ?

Thanks in advance,
Attachments
SineWaveAlsa.txt
had to change the extension from .elf to .txt to upload it
(54.13 KiB) Downloaded 47 times
SineWaveAlsa.cpp
(6.14 KiB) Downloaded 48 times

joy
Posts: 728
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 0
Been thanked: 4 times
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by joy » Thu Nov 01, 2018 5:10 pm

Hi Mobilaz,
Thank you for sharing the files.
Please let us check the issue for a couple of days.

Mobilaz
Posts: 6
Joined: Tue Oct 30, 2018 8:00 pm
languages_spoken: english
ODROIDs: ODROID-C2
Has thanked: 0
Been thanked: 0
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by Mobilaz » Tue Nov 06, 2018 6:49 pm

Hi,

Were you able to reproduce the issue ? The image used for my test is the "ubuntu-18.04-3.16-minimal-odroid-c2.img".

I kept digging a bit more in the source code and the datasheet to find the HDMI and audio clocks differences between LE and Ubuntu Kernel. So far, I couldn’t spot the issue.

I’d like to better understand the clocking of the HDMI/AUDIO device. So, I really need clear and complete documentation.
While digging into the S905 public datasheet, which clearly lacks details, I encountered a reference to a clock tree document. Do you know where I could find this referenced document which would be very helpful to understand.

I am also missing some parts of the audio data flow via HDMI:

- Is I2S used to transfer data ?
- How does the audio go from the memory to the final HDMI output ? (any hardware codec ?)

Would it be possible to have access to a more detailed datasheet of the S905 amlogic processor ?

Thanks in advance,

joy
Posts: 728
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 0
Been thanked: 4 times
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by joy » Wed Nov 07, 2018 8:41 am

Mobilaz wrote: Were you able to reproduce the issue ? The image used for my test is the "ubuntu-18.04-3.16-minimal-odroid-c2.img".
I kept digging a bit more in the source code and the datasheet to find the HDMI and audio clocks differences between LE and Ubuntu Kernel. So far, I couldn’t spot the issue.
Hi Mobilaz,
Sorry for late response.

Yes, I could reproduce the issue and hear the glitch noise (like pop-up noise)
and also tried LibreELEC then no issue.
I also tried USB audio adapter on ubuntu 18.40 and in this case, no issue.

To make sure the output, I also checked the sine wave from HDMI using oscilloscope
and I got 200Hz sinewave and no signal drop in my eyes.

We're still looking into differences between LibreELEC and Ubuntu 3.16 version.
So I will try 3.14 kernel version on Ubuntu 18.04.
Mobilaz wrote: I’d like to better understand the clocking of the HDMI/AUDIO device. So, I really need clear and complete documentation.
While digging into the S905 public datasheet, which clearly lacks details, I encountered a reference to a clock tree document. Do you know where I could find this referenced document which would be very helpful to understand.
I am also missing some parts of the audio data flow via HDMI:
- Is I2S used to transfer data ?
- How does the audio go from the memory to the final HDMI output ? (any hardware codec ?)
Would it be possible to have access to a more detailed datasheet of the S905 amlogic processor ?
About it, Sorry. The documentation shared in wiki page is all.
Also, we don't have any detailed S905 datasheet that is not opened to ODROID users, too. :(

joy
Posts: 728
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 0
Been thanked: 4 times
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by joy » Wed Nov 07, 2018 11:05 am

Hello Mobilaz,
I've checked 3.14.y kernel on Ubuntu 18.04 and got the same issue with 3.16.y,
and found hdmi sound driver under sound/soc/aml/ is quite different from LibreELEC kernel.
So could you please check us it more internally for more days?

Mobilaz
Posts: 6
Joined: Tue Oct 30, 2018 8:00 pm
languages_spoken: english
ODROIDs: ODROID-C2
Has thanked: 0
Been thanked: 0
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by Mobilaz » Thu Nov 08, 2018 11:32 pm

Hi Joy,

Thanks for looking into this issue.

I analyzed the hdmi audio output with an external device and I could isolate the issue.

There is a single audio sample set to zero every 7 sec at a sample rate of 48kHz as can be seen in the attached picture.

I am looking forward to hearing from you.

Thanks in advance,
Attachments
48k_sine_18sec.PNG
48k_sine_18sec.PNG (41.36 KiB) Viewed 1540 times

joy
Posts: 728
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 0
Been thanked: 4 times
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by joy » Fri Nov 09, 2018 10:05 am

Hi Mobilaz,
My colleague in charge of audio has been fixed this issue. ;)
He will share his patch soon.

cap00k
Posts: 78
Joined: Tue May 21, 2013 10:46 am
languages_spoken: english
ODROIDs: ODROID
Has thanked: 0
Been thanked: 0
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by cap00k » Fri Nov 09, 2018 12:01 pm

Hi Mobilaz,

I reviewed the issue, I noticed that there was a difference between the audio clock and the hdmi clock.
So I applied this patch to fix the problem. This is a patch for clock settings when i2s data is the source of hdmi audio output.
Could you tell me apply this patch and test it then results?
Attachments
0001-ODROID-C2-Modified-HDMI-sound-glitch.zip
(927 Bytes) Downloaded 22 times

Mobilaz
Posts: 6
Joined: Tue Oct 30, 2018 8:00 pm
languages_spoken: english
ODROIDs: ODROID-C2
Has thanked: 0
Been thanked: 0
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by Mobilaz » Fri Nov 09, 2018 7:13 pm

Hi,

Thanks for your solution.

I tested the patch on the sine wave and it seems to be working just fine.
I will run some long term tests to be sure it works in all scenarios and I will keep you posted with the results.

Thank you very much for your help,

Isard7777
Posts: 11
Joined: Fri Aug 10, 2018 5:25 pm
languages_spoken: english french
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by Isard7777 » Tue Nov 13, 2018 1:44 am

Hello,

I'm working on the same project of Mobilaz. During the validation of the provided patch, I try to see if a drift between the HDMI Video clock (Vsync) and the Alsa Audio Clock (through Alsa callback) is still remained. The software we used is simple, on each Vsync, we virtualy generate 800 empty audio samples (corresponding of the number of sample needed on each video frame at 60Hz), that the alsa callback must consume.

Unfortunately the drift is still present and I calculate, without any other configuration than the provided patch, a drift of 0.236833 audio sample / second. I've also decided to use the tsync driver (/sys/class/tsync/mode) and change the mode to see if it was possible to have any benefit effect on the clocks drift but, the audio master clock give us exactly the same drift, the video master clock give us a drift of 0.2399 audio sample /second and the PCR master clock also give us a greater drift of 0.237241.

Is it normal that the provided patch does not solve the clock drift between the audio and the video from the moment where there is no more sound glitch explained by clock derivation? Is it possible to configure the odroid to have the same clock source between the Alsa callback and the Framebuffer Vsync?

Thanks.
Last edited by Isard7777 on Tue Nov 13, 2018 5:23 pm, edited 1 time in total.

joy
Posts: 728
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 0
Been thanked: 4 times
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by joy » Tue Nov 13, 2018 8:46 am

Isard7777 wrote: Is it normal that the provided patch does not solve the clock drift between the audio and the video from the moment wher there is no more sound glitch explained by clock derivation?
Is it possible to configure the odroid to have the same clock source between the Alsa callback and the Framebuffer Vsync?
They don't share the same clock source.
And this commit doesn't affect framebuffer vsync or hdmi pixel clock and so on.
HDMI uses a dedicated pll block.
The commit is to synchronize data from I2S output to HDMI input.
During the process, data at a specific moment is lost.
It depends on I2S block.

And usually, Audio and HDMI use each dedicated pll blocks because various kinds of clocks must be generated.

rkos
Posts: 2
Joined: Thu Nov 22, 2018 3:55 am
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by rkos » Thu Nov 22, 2018 4:13 am

Hi,
I seem to have a similar problem: Currently I test the audio output via SPDIF. However, there are clicks at regular intervals. The higher the sampling rate, the shorter the intervals between two clicks, at 44k1 about 40 seconds, at 192k about every 3s.
At 44k1 I analyzed it more closely, recorded it and compared it to the original file: after 40s a sample is missing and the audio is shifted by this sample. With HDMI via a converter to SPDIF the clicks are also present. I use Volumio as player/OS.
I would try the above patch. But how do I install that? Or any other idea?
Does anyone use Volumio and a DAC via I2S without problems? Ideally at 192kHz, because at lower sampling rates this is not so noticeable. Then I would just use an AES3 transmitter, which generates the SPDIF from I2S.

joy
Posts: 728
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 0
Been thanked: 4 times
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by joy » Fri Nov 23, 2018 8:59 am

Hi, rkos.
A new version has been released including the related commit.
https://github.com/hardkernel/linux/com ... 775d930c7a

You can update kernel package to the latest one by apt-get update & upgrade.

Code: Select all

$ sudo apt-get update -y && sudo apt-get upgrade -y
Then, do reboot.

Code: Select all

$ sudo reboot
And please check your version.

Code: Select all

$ uname -a
Linux odroid 3.16.60-28 #1 SMP PREEMPT Thu Nov 15 06:06:45 -02 2018 aarch64 aarch64 aarch64 GNU/Linux

rkos
Posts: 2
Joined: Thu Nov 22, 2018 3:55 am
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by rkos » Mon Nov 26, 2018 7:42 pm

Hi Joy,
Thanks a lot for your reply. Unfortunately the update does not work with Volumio/Odroid.
I'll ask the Volumio team if they can implement the new kernel version in a new version.
Otherwise, I have now connected an AES transmitter via I2S and that works great.

joy
Posts: 728
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 0
Been thanked: 4 times
Contact:

Re: [HDMI] Sound glitch every 3 sec

Unread post by joy » Tue Nov 27, 2018 11:35 am

rkos wrote:Hi Joy,
Thanks a lot for your reply. Unfortunately the update does not work with Volumio/Odroid.
I'll ask the Volumio team if they can implement the new kernel version in a new version.
Otherwise, I have now connected an AES transmitter via I2S and that works great.
Oops, I couldn't catch that you use Volumio/Odroid.
I'm not sure the base version is same but please refer to this patch.
https://github.com/hardkernel/linux/com ... 775d930c7a

Post Reply

Return to “Issues”

Who is online

Users browsing this forum: No registered users and 2 guests