sonocotta / tas5805m-for-raspbian-paspberry-pi-zero

device tree and kernel module for running TI TAS5805M DAC on Raspberry Pi
GNU General Public License v3.0
9 stars 0 forks source link

Pi kernel panics or freezes after stopping playback with i2c errors on Louder Pi #5

Closed matqua closed 2 months ago

matqua commented 2 months ago

Issue

Playing audio through Mopidy or sox/play on the command line, the Pi will freeze or kernel fault/panic, sometimes taking out the network/ssh connection or freezing the Pi and requiring a power cycle.

Following the instructions here https://github.com/sonocotta/tas5805m-for-raspbian-paspberry-pi-zero

Testing hardware/software

Outputs

uname -a

Linux musicpi 6.6.31+rpt-rpi-v7 #1 SMP Raspbian 1:6.6.31-1+rpt1 (2024-05-29) armv7l GNU/Linux

aplay -l

house@musicpi:~/El Kiddos $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: LouderRaspberry [Louder-Raspberry], device 0: 3f203000.i2s-tas5805m-amplifier tas5805m-amplifier-0 [3f203000.i2s-tas5805m-amplifier tas5805m-amplifier-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
anabolyc commented 2 months ago

Hey, thanks for reporting and good work on details. First thing that comes to mind is power source. Can you please measure VUSB and 5v test points? Do they measure proper voltage? Does it stay stable during boot?

On Sun, Jun 9, 2024 at 13:23 matqua @.***> wrote:

Issue

Playing audio through Mopidy or sox/play on the command line, the Pi will freeze or kernel fault/panic, sometimes taking out the network/ssh connection or freezing the Pi and requiring a power cycle.

Following the instructions here https://github.com/sonocotta/tas5805m-for-raspbian-paspberry-pi-zero

-

I did have to do an apt upgrade before following the instructions (I could not get to the end of the instructions without the Pi freezing every time I closed the speaker-test)

After that everything seemed fine, aplay -l returns the correct values and the speaker-test command executed fine and would let me terminate it without any faults.

Next set the volume with alsamixer fine.

Next play a FLAC from the local SD card.

File will play fine but upon CTRL-C to play something else, faults/panics in the kernel log/console and the sound device disappears (aplay -l returns no devices)

See the following dmesg-afterflac.txt https://github.com/user-attachments/files/15751611/dmesg-afterflac.txt dmesg-2.txt https://github.com/user-attachments/files/15751612/dmesg-2.txt dmesg-1.txt https://github.com/user-attachments/files/15751613/dmesg-1.txt

See history.txt https://github.com/user-attachments/files/15751621/history.txt for the install commands ran initially on the Pi Zero 2W (after on the Pi 3B+ I had the apt upgrade completed before following the instructions.

I re-imaged the SD card every time, and tried both 32bit and 64 bit Bookworm Rasbian Lite images

Testing hardware/software

  • I started testing with a Pi Zero 2W but ended up opening the case and sticking a Pi 3B+ on there.
  • Initially it was a Pi Zero 2W using the onboard w5500 network connection, then with the zero's wifi
  • Next I used a Pi 3B+ with it's onboard ethernet to speed up the testing, also to connect a local console over HDMI
  • Power supply is a 100W Lenovo USB-C ( https://www.lenovo.com/au/en/p/accessories-and-software/chargers-and-batteries/chargers/4x21m37477 )
  • Two different micro-sd cards
  • Imaged with two different computers (Windows & Mac)

Outputs uname -a

Linux musicpi 6.6.31+rpt-rpi-v7 #1 SMP Raspbian 1:6.6.31-1+rpt1 (2024-05-29) armv7l GNU/Linux aplay -l

@.*:~/El Kiddos $ aplay -l ** List of PLAYBACK Hardware Devices **** card 0: LouderRaspberry [Louder-Raspberry], device 0: 3f203000.i2s-tas5805m-amplifier tas5805m-amplifier-0 [3f203000.i2s-tas5805m-amplifier tas5805m-amplifier-0] Subdevices: 1/1 Subdevice #0: subdevice #0

ā€” Reply to this email directly, view it on GitHub https://github.com/sonocotta/tas5805m-for-raspbian-paspberry-pi-zero/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJU6I3PRN73IKXJY7WCXU3ZGQ3J3AVCNFSM6AAAAABJAZXUEKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM2DEMJXGAYDMNI . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

matqua commented 2 months ago

Voltages

Command line test

matqua commented 2 months ago

Please note, this is with the Pi 3B+ still connected rather than the Pi Zero 2W. I don't see any signs of under-voltage occurring with the PI but thought I better still mention it.

anabolyc commented 2 months ago

Hey @matqua

Voltages look good, so that is out of the way.

I'm no linux expert, and looking through the logs, and it looks like at some point communication with the DAC fails, not sure if no ACK is the reason, or something else. It could be a bug in specific chip, or in the kernel driver.

Can you give me the specific command that triggers the bug and the command that pulls the error log (is it just dmesg?). I want to try it on my board and see if I get the same result.

Do you happen to have Raspberry Pi Zero 1 to test the same? Asking, since I only have them in stock to do the test on my side.

anabolyc commented 2 months ago

Can you please also please check if DAC chip happen to heat up (finger test) and if there are obvious issues with soldering (solder bridges, or lack of solder) around DAC chip, as well as Raspberry connector.

matqua commented 2 months ago

@anabolyc No worries I'll setup a Pi Zero 1 W and document the setup step by step shortly

matqua commented 2 months ago

Process

  1. Flash raspi os lite 32 bit bookworm 2024-03-15

  2. Customise with ssh, hostame, username, wifi, locale

  3. Bootup pi

  4. sudo apt install screen tmux

  5. sudo apt update && sudo apt upgrade -y

  6. Reboot

  7. uname -a Linux musicpi 6.6.31+rpt-rpi-v6 #1 Raspbian 1:6.6.31-1+rpt1 (2024-05-29) armv6l GNU/Linux

  8. screen

  9. sudo apt update && sudo apt install git raspberrypi-kernel-headers build-essential -y

  10. git clone https://github.com/sonocotta/tas5805m-for-raspbian-paspberry-pi-zero && cd tas5805m-for-raspbian-paspberry-pi-zero

  11. sudo ./compile-overlay.sh

  12. sudo nano /boot/firmware/config.txt

    
    # Enable DAC
    dtoverlay=tas5805m,i2creg=0x2d

And commented out these lines

dtparam=audio=on

dtoverlay=vc4-kms-v3d

 13. `make all`

house@musicpi:~/tas5805m-for-raspbian-paspberry-pi-zero $ make all make -C /lib/modules/6.6.31+rpt-rpi-v6/build M=/home/house/tas5805m-for-raspbian-paspberry-pi-zero modules make[1]: Entering directory '/usr/src/linux-headers-6.6.31+rpt-rpi-v6' CC [M] /home/house/tas5805m-for-raspbian-paspberry-pi-zero/tas5805m.o MODPOST /home/house/tas5805m-for-raspbian-paspberry-pi-zero/Module.symvers CC [M] /home/house/tas5805m-for-raspbian-paspberry-pi-zero/tas5805m.mod.o LD [M] /home/house/tas5805m-for-raspbian-paspberry-pi-zero/tas5805m.ko make[1]: Leaving directory '/usr/src/linux-headers-6.6.31+rpt-rpi-v6'

14. `sudo make install`

house@musicpi:~/tas5805m-for-raspbian-paspberry-pi-zero $ sudo make install sudo cp /home/house/tas5805m-for-raspbian-paspberry-pi-zero/tas5805m.ko /lib/modules/6.6.31+rpt-rpi-v6/kernel/sound/soc/codecs/snd-soc-tas5805m.ko sudo depmod -a

15. `sudo reboot`

16. `uname -a`

Linux musicpi 6.6.31+rpt-rpi-v6 #1 Raspbian 1:6.6.31-1+rpt1 (2024-05-29) armv6l GNU/Linux house@musicpi:~ $ aplay -l List of PLAYBACK Hardware Devices card 0: LouderRaspberry [Louder-Raspberry], device 0: 20203000.i2s-tas5805m-amplifier tas5805m-amplifier-0 [20203000.i2s-tas5805m-amplifier tas5805m-amplifier-0] Subdevices: 1/1 Subdevice #0: subdevice #0

17. `lsmod | grep tas5805m`

house@musicpi:~ $ lsmod | grep tas5805m tas5805m 12288 1 regmap_i2c 12288 1 tas5805m snd_soc_core 278528 4 snd_soc_simple_card_utils,snd_soc_bcm2835_i2s,tas5805m,snd_soc_simple_card



18. `speaker-test -t sine -f 500 -c 2`

Worked perfectly fine and CTRL+C it stopped with no errors in the kernel log.

19. Turned down volume with `alsamixer` to 5

20. `speaker-test -t sine -f 500 -c 2`

Worked perfectly fine again and CTRL+C it stopped with no errors in the kernel log.

21. `aplay /usr/share/sounds/alsa/Front_Center.wav`

Played fine. but then BUG/exception in kernel log

22. `aplay /usr/share/sounds/alsa/Front_Center.wav`

Played fine again with the BUG/exception in kernel log.

23. `sudo apt install sox`

24. `sudo apt install flac`

25. scp a flac file across to the pi

26. `play filename.flac`

Plays fine then CTRL+C and BUG/exception in kernel log.

27. `play filename.flac`

Plays fine again then CTRL+C and BUG/exception in kernel log again.

[dmesg-newpizero.txt](https://github.com/user-attachments/files/15755181/dmesg-newpizero.txt)
matqua commented 2 months ago

Followup

anabolyc commented 2 months ago

Hey @matqua I followed your steps and I can confirm the same kernel error message each time I play wav. I'll try to look little closer at what can cause it. In my case I never lost audio card itself in aplay -l, so it is usable even after this error

matqua commented 2 months ago

Thanks @anabolyc

Yes the audio card is still available after using play or aplay. It is only when using Mopidy to play a file does the device disappear.

anabolyc commented 2 months ago

@matqua sorry, still looking into the issue. struggling to find time for everything

anabolyc commented 2 months ago

Hey @matqua I think I fixed the issue in the #6 . I tested with Raspberry Pi Zero. can you please test on your side, including other Pi models that you have.

matqua commented 2 months ago

Hi @anabolyc Looks good. Playing local flac files worked fine. Mopidy playing local flacs works well too.

Thank you very much! Great work šŸ‘

matqua commented 2 months ago

@anabolyc I tested with a Pi Zero 2W

anabolyc commented 2 months ago

@matqua thanks for testing, I merged the PR and closing the issue.