linux
linux copied to clipboard
HifiBerry DAC+ADC audio glitches on Pi 5 at 192 kHz when stressing memory
Describe the bug
On a Pi 5, when memory is stressed (see below), the HifiBerry DAC+ADC has audio glitches when playing audio at high sample rates. Placing the exact same SD card in a Pi 4 works fine.
Steps to reproduce the behaviour
- Create a 192 kHz file
- Play it with aplay filename
- Run
stress -vm 2
(or higher) (sudo apt-get install stress
if needed)
Device (s)
Raspberry Pi 5
System
Raspberry Pi reference 2022-04-04 Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 27a8050c3c06e567c794620394a8c2d74262a516, stage2
2023/10/30 16:45:10 Copyright (c) 2012 Broadcom version 30de0ba5 (release) (embedded)
Linux thimeo-pi 6.6.30-v8+ #1762 SMP PREEMPT Thu May 9 15:17:51 BST 2024 aarch64 GNU/Linux
This Linux version is the one that you get with rpi-upgrade as suggested in https://www.hifiberry.com/blog/changes-in-hifiberry-drivers/ . But I experienced the exact same behavior with the currently released version (6.1.0 if I recall correctly), when adding ",slave" to the dtoverlay to make the HifiBerry card work on that system. There, also, the same image worked fine on a Pi 4.
Logs
No response
Additional context
I noticed this problem with our own software, and with "stress" I stressed several things separately. Only memory (-vm option) causes issues; I/O, HDD and CPU do not. Glitches clearly get worse if the stressing is increased; with -vm 2 I'm getting dozens of cracks (it almost sounds like a tone) per second. Talking to ALSA with bigger block sizes does not help; we've tried sizes up to 69 ms with no effect at all on the resulting audio. Lowering the priority of the threads that stress the memory, even to idle, does not help.