Witaj na Forum Linuxiarzy
Zanim zalogujesz się, by pisać na naszym forum, zapoznaj się z kilkoma zasadami savoir-vivre'u w dziale Administracja.
Wiadomości z problemami zamieszczone w wątku "Przywitaj się" oraz wszelkie reklamy na naszym forum będą usuwane.

[Raspbian Jessie] Problem z kartą dźwiękową na I2S

Zaczęty przez Atlantis, Sierpień 22, 2016, 07:21:13 PM

Poprzedni wątek - Następny wątek

Atlantis

Ostatnio eksperymentuję z Raspberry Pi Zero, podłączając do niego rozmaite interfejsy. Docelowo zdobyta wiedza ma posłużyć do skonstruowania radia internetowego/odtwarzacza multimedialnego w postaci osobnej płytki z niezbędnymi obwodami, w którą będzie się wpinało RasPi0.
Nie miałem większych problemów z podłączenie kontrolera Ethernetu (ENC28J60), RTC albo wyświetlacza LCD, ale utknąłem na temacie karty dźwiękowej na I2S.

A więc po kolei:

Używa Raspbiana Jessie.

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.4.18+ #905 Fri Aug 19 19:04:48 BST 2016 armv6l GNU/Linux


Karta dźwiękowa jest trochę nietypowa - została skonstruowana i zbudowana przez znajomego. Dostałem od niego dwa moduły do eksperymentów. Konstrukcja jest oparta na układzie wm8731. Układ jest sprawdzony - znajomy sam z niego korzystał, używając opisu konfiguracji dostępnego pod poniższym linkiem.

http://blog.koalo.de/2013/05/i2s-support-for-raspberry-pi.html

Ja też od tego zacząłem, modyfikując zawartość pliku /etc/modules. Opis związany z kompilacją jądra pominąłem, bo o ile mi wiadomo niezbędne moduły są już standardowo dołączane do systemu.
Nie było jednak żadnego efektu - system w ogóle nie widział nowej karty. Trochę doczytałem i wygląda na to, że obsługa modułów zmieniła się nieco w nowszych wersjach Raspbiana i obecnie służy do tego plik /boot/config.txt.

Zmodyfikowałem więc nieco jego zawartość, dodając:


dtparam=i2s=on
dtoverlay=i2s-mmap
dtoverlay=rpi-proto


To posuniecie przyniosło częściowy sukces - w systemie pojawiła się nowa karta:


pi@raspberrypi:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sndrpiproto [snd_rpi_proto], device 0: WM8731 HiFi wm8731-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0


Niemniej w dmesg podczas ładowania systemu widać następujące błędy:


[    9.949830] snd-rpi-proto soc:sound: ASoC: CPU DAI (null) not registered
[    9.949873] snd-rpi-proto soc:sound: snd_soc_register_card() failed: -517
[   10.033350] snd-rpi-proto soc:sound: ASoC: CODEC DAI wm8731-hifi not registered
[   10.033391] snd-rpi-proto soc:sound: snd_soc_register_card() failed: -517


Niestety, nie jestem w stanie niczego odtworzyć za pośrednictwem tej karty. Gdy próbuję, w głośnikach niczego nie słychać, a dmesg pokazuje następujące błędy:


[  175.093402] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  176.125304] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  176.126270] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  176.265806] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  176.266904] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  176.401606] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  176.404439] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  176.537227] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  176.538326] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  176.681712] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  176.684665] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  176.817584] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  176.818675] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  176.956826] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  176.957937] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  177.385810] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  177.386895] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  177.529215] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  177.530317] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  177.665241] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  177.666336] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  177.809628] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  177.810648] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  177.945254] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  177.946357] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  178.081234] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  178.084148] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  178.369558] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  178.370646] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  178.674011] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  178.675104] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  178.857513] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  178.858525] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  179.001635] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  179.004530] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  179.148841] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  179.149771] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  179.289615] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  179.290699] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  179.433477] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  179.434574] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  179.715973] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  179.716909] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  179.995777] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  179.996725] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  180.289753] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  180.290762] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  180.481873] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  180.484779] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  180.795763] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  180.796691] bcm2835-i2s 20203000.i2s: I2S SYNC error!
[  181.066295] bcm2835-dma 20007000.dma: DMA transfer could not be terminated
[  181.067247] bcm2835-i2s 20203000.i2s: I2S SYNC error!


lsmod zwraca następującą informację:


pi@raspberrypi:~ $ lsmod
Module                  Size  Used by
cfg80211              499234  0
rfkill                 21397  1 cfg80211
snd_soc_wm8731         13517  1
regmap_spi              2491  1 snd_soc_wm8731
regmap_i2c              4078  1 snd_soc_wm8731
snd_soc_bcm2835_i2s     6994  2
regmap_mmio             3728  1 snd_soc_bcm2835_i2s
snd_soc_rpi_proto       3228  0
snd_bcm2835            23131  0
snd_soc_core          164100  3 snd_soc_wm8731,snd_soc_bcm2835_i2s,snd_soc_rpi_proto
snd_pcm_dmaengine       5906  1 snd_soc_core
snd_pcm                95473  5 snd_bcm2835,snd_soc_wm8731,snd_soc_core,snd_soc_rpi_proto,snd_pcm_dmaengine
snd_timer              22460  1 snd_pcm
snd                    68368  5 snd_bcm2835,snd_soc_wm8731,snd_soc_core,snd_timer,snd_pcm
i2c_bcm2708             5740  0
bcm2835_gpiomem         3823  0
bcm2835_wdt             4133  0
uio_pdrv_genirq         3718  0
uio                    10230  1 uio_pdrv_genirq
fb_ili9341              4036  1
enc28j60               20274  0
i2c_dev                 6578  0
fbtft_device           37141  0
fbtft                  32551  2 fb_ili9341,fbtft_device
syscopyarea             3161  1 fbtft
sysfillrect             3716  1 fbtft
sysimgblt               2422  1 fbtft
fb_sys_fops             1677  1 fbtft
spi_bcm2835             7424  0
ipv6                  367575  28


Jestem prawie pewien, że problem nie ma natury sprzętowej. Wielokrotnie sprawdziłem wszystkie połączenia, sam układ wm8731 jest wykrywany na magistrali i2c. Kartę dźwiękową próbowałem podłączyć do dwóch różnych Raspberry Pi (Zero i pierwszy w wersji rev2). Podejrzewam, że pewnie w nowej wersji Raspbiana jeszcze coś trzeba skonfigurować, czegoś brakuje. Tylko czego?

Zobacz najnowsze wiadomości na forum