Sound issue on linux-imx 6.1.1 with imx8mn-evk

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sound issue on linux-imx 6.1.1 with imx8mn-evk

Jump to solution
1,756 Views
emontmasson
Contributor I

Hello,

While working on an imx8mn-evk board used with an AUD-EXP-42448 sound card (which use a cs42448 chip), I encountered some regressions on my applications when upgrading the kernel from linux-imx 5.4.70 to linux-imx 6.1.1.

The imx board receives audio data from the sound card, data that is then processed through the Pipewire sound server and other sound processing software.s, before being sent back to the sound card.
As this setup requires an RT kernel, the linux-imx kernel is patched with the closest available RT patch of the mainline linux.

While using the linux-imx kernel 5.4.70, there was no specific problem. I use the mainline RT patch 5.4.70-rt40.
After upgrading to linux-imx 6.1.1 and using the mainline RT patch 6.1-rc7-rt5 (as there is no patch for the linux 6.1.1), the output audio gets noise that wasn't there with the previous kernel.

I tried multiple ideas to investigate the problem :

  • use a loopback in Pipewire between the input and output audio, then do the same with a Jack server. Same problem occurs in both cases.
  • test the RT capabilities with cyclictest, with 100 millions cycles (~5H) : maximum latency is 109 us, which doesn't lead to a clear RT malfunction.
  • use arecord and aplay either by their own or pipelined to mimic a loopback. Both cases work without problem.
  • use alsaloop. With a period size of 256 samples, there is the problem of noise, but with a greater size, the sound is clear.
  • trace CPU usage with LTTng. CPU is not overloaded at all, and SDMA IRQs regarding the sound card playback and capture stream are occurring at regular intervals coherent with latencies.
  • use the SAI in synchronous mode. Doesn't change anything.
  • give a sinus as input and observe the output signal. It is the same sinus but discontinued, with some part skipped (see attached picture below)

sin_test.png

The fact we can work-around the issue by increasing the alsa period size makes it look like a latency/real-time issue. However the cyclictest results don't show a clear regression on this point. The issue is reproduced on a standard linux-imx 6.1 without RT patch applied, in a standard configuration.
What is the path recommended by NXP to enable RT behaviour on a linux-imx kernel? Is there a possibility that a difference between mainline and linux-imx causes RT issues?

Regards.

0 Kudos
Reply
1 Solution
1,699 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

Consulting internally those patches are not tested on our Kernel and hardware, so maybe this could cause the issues you had. Preemtive RT Linux is implemented on i.MX devices using Real Time Edge, but it is on 5.4.7 Kernel.

I suggest you try the tested version, right now it is not implemented on 6.1 Kernel.

Best regards.

View solution in original post

0 Kudos
Reply
3 Replies
1,728 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

Could you please share me where did you get that RT patch and how you are applying/configuring it?

Best regards.

0 Kudos
Reply
1,715 Views
emontmasson
Contributor I

Hello,

I applied the RT patch 6.1-rc7-rt5 at https://cdn.kernel.org/pub/linux/kernel/projects/rt/6.1/older/. I had to slightly adapt the patch due to some differences in files arch/arm/include/asm/thread_info.h and arch/arm/kernel/asm-offsets.c of linux-imx compared to the mainline version.

The patch is added to the Yocto project and applied during build. The kernel configuration used is the in-tree imx_v8_defconfig, to which a configuration fragment enables RT options (CONFIG_EXPERT and CONFIG_PREEMPT_RT).

 

I have also been able to use a mainline kernel RT v6.1.26, and I don't have the noise problem with it.

 

Regards.

0 Kudos
Reply
1,700 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

Consulting internally those patches are not tested on our Kernel and hardware, so maybe this could cause the issues you had. Preemtive RT Linux is implemented on i.MX devices using Real Time Edge, but it is on 5.4.7 Kernel.

I suggest you try the tested version, right now it is not implemented on 6.1 Kernel.

Best regards.

0 Kudos
Reply