WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: support for HiFiBerry Digi I2S modules - help needed.  (Read 15670 times)

Offline sbp

  • Sr. Member
  • ****
  • Posts: 429
    • piCorePlayer homepage
support for HiFiBerry Digi I2S modules - help needed.
« on: February 10, 2014, 01:49:45 PM »
Hi
I have managed to make e new version of piCore build on kernel 3.12.9 and piCore 5.2 alpha.

It is working fine, I have updated the Alsa-package and both the analog output (ALSA bcm2835) as well as HiFiBerry DAC I2S and USB audio is working fine as before.
However, the reason for using the 3.12.9 kernel was an attempt to support the HiFiBerry Digi, so that our Raspberry could get a digital audio out.

The modules are present and seems to be loading, according to the author of the modules the following need to be there for the digital card to function:
snd_soc_bcm2708_i2s
bcm2708_dmaengine
snd_soc_wm8804
snd_soc_hifiberry_digi

He also mentioned that it might need I2C modules??

I have a few errors when booting that seems important:
Code: [Select]

[   19.361317] bcm2708-i2s bcm2708-i2s.0: Failed to create debugfs directory
[   20.642630] usbcore: registered new interface driver snd-usb-audio
[   23.651908] FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[   23.723027] usbcore: deregistering interface driver snd-usb-audio
[   23.940820] usbcore: registered new interface driver snd-usb-audio
[   24.265022] wm8804 1-003b: Failed to read device ID: -1
[   24.265060] wm8804 1-003b: ASoC: failed to probe CODEC -1
[   24.265146] snd-hifiberry-digi snd-hifiberry-digi.0: ASoC: failed to instantiate card -1
[   24.265235] snd-hifiberry-digi snd-hifiberry-digi.0: snd_soc_register_card() failed: -1
[   24.265276] snd-hifiberry-digi: probe of snd-hifiberry-digi.0 failed with error -1

However this is the output from lsmod:
Code: [Select]
tc@piCorePlayer:~$ lsmod
Module                  Size  Used by    Not tainted
snd_soc_hifiberry_digi     2572  0
bcm2708_dmaengine       5104  0
virt_dma                2021  1 bcm2708_dmaengine
snd_usb_audio         116218  0
snd_usbmidi_lib        18720  1 snd_usb_audio
snd_rawmidi            20133  1 snd_usbmidi_lib
snd_seq_device          6034  1 snd_rawmidi
snd_hwdep               5917  1 snd_usb_audio
snd_bcm2835            16116  1
snd_soc_wm8804          7692  0
snd_soc_bcm2708_i2s     5486  0
snd_soc_core          115066  3 snd_soc_hifiberry_digi,snd_soc_wm8804,snd_soc_bcm2708_i2s
snd_pcm_dmaengine       4564  1 snd_soc_core
snd_pcm                74840  5 snd_usb_audio,snd_bcm2835,snd_soc_core,snd_pcm_dmaengine
snd_page_alloc          4680  1 snd_pcm
snd_timer              19270  1 snd_pcm
snd_compress            7974  1 snd_soc_core
snd                    56397 11 snd_usb_audio,snd_usbmidi_lib,snd_rawmidi,snd_seq_device,snd_hwdep,snd_bcm2835,snd_soc_core,snd_pcm,snd_timer,snd_compress
regmap_i2c              1522  2 snd_soc_wm8804,snd_soc_core
regmap_spi              1778  2 snd_soc_wm8804,snd_soc_core
regmap_mmio             2673  1 snd_soc_bcm2708_i2s

But no HiFiBerry Digi card is to be seen:
Code: [Select]
tc@piCorePlayer:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 7/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
tc@piCorePlayer:~$


Can anybody see what is wrong?

Steen


Offline sbp

  • Sr. Member
  • ****
  • Posts: 429
    • piCorePlayer homepage
Re: support for HiFiBerry Digi I2S modules - help needed.
« Reply #1 on: February 10, 2014, 02:02:19 PM »
Hi

I got an answer from the author of the modules. He wrote that I probably needed:
Code: [Select]
i2c-bcm2708
i2c-dev

So Now I'm searching for these modules.
I don't know if they are produced (I used the .config file from bmarkus piCore5.2 alpha build).

Steen

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: support for HiFiBerry Digi I2S modules - help needed.
« Reply #2 on: February 10, 2014, 02:19:10 PM »
i2c-bcm2708 and i2c-dev are built into the kernel, not modules, see modules.builtin
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline sbp

  • Sr. Member
  • ****
  • Posts: 429
    • piCorePlayer homepage
Re: support for HiFiBerry Digi I2S modules - help needed.
« Reply #3 on: February 10, 2014, 02:30:08 PM »
Thanks.

Is there a Way to test if they are loaded/available?
Or is that a stupid question?

The reason for asking is that when you read about these modules on raspberry forums, they are always mentioned as blacklisted and not loaded.

Steen
« Last Edit: February 10, 2014, 02:34:43 PM by sbp »

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1251
Re: support for HiFiBerry Digi I2S modules - help needed.
« Reply #4 on: February 10, 2014, 05:03:01 PM »
Thanks.

Is there a Way to test if they are loaded/available?
Or is that a stupid question?

The reason for asking is that when you read about these modules on raspberry forums, they are always mentioned as blacklisted and not loaded.

Steen

i2c works fine, I'm using 4 different i2c modules on bus 1 and the hifiberry analog dac on bus 0.

but to make you feel better.  look at the kernel config in the /proc directory.

When you compile a kernel, you have 3 options
y - Means the driver is compiled directly into the kernel, and is always present.
m - The driver is compiled as a module that will be loaded after the kernel is booted.
n - the driver is not built or available to be used later.

starting with piCore 5.1. these 2 drivers are now marked "y" in the kernel .config.   They are there.   Run

i2cdetect 0 or i2cdetect 1   (i2cdetect is in the i2ctools extension)



« Last Edit: February 10, 2014, 05:10:38 PM by Paul_123 »

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1251
Re: support for HiFiBerry Digi I2S modules - help needed.
« Reply #5 on: February 10, 2014, 05:08:53 PM »
Make sure you are loading the drivers in the correct order.   If you load them in the wrong order, it will fail.

I have 3.12.9 built as well, I'll try to load the driver tonight and see if it works for me.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1251
Re: support for HiFiBerry Digi I2S modules - help needed.
« Reply #6 on: February 10, 2014, 08:24:08 PM »
I get the same error on my system.   And this system has a hifiberry_dac(analog), so I know the i2c is working.

I know the analog dac is a only a client on the i2c bus, the rpi has no idea that it is there, and the drivers will load without the card.

I have not searched for information on the Digi version, will the drivers load without the card present?

Offline sbp

  • Sr. Member
  • ****
  • Posts: 429
    • piCorePlayer homepage
Re: support for HiFiBerry Digi I2S modules - help needed.
« Reply #7 on: February 11, 2014, 02:05:33 PM »
I get the same error on my system.   And this system has a hifiberry_dac(analog), so I know the i2c is working.

I know the analog dac is a only a client on the i2c bus, the rpi has no idea that it is there, and the drivers will load without the card.

I have not searched for information on the Digi version, will the drivers load without the card present?

Just got an answer from Daniel, the author of the HiFiBerry modules:
Code: [Select]
DAC and Digi drivers are different. The DAC driver has no idea about the hardware itself. The Digi driver has to initialize the hardware by I2C. This does not seem to work in your setup..

So now I'm testing whether the card is dead or not. Next I will need to figure out what to do.

Steen

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1251
Re: support for HiFiBerry Digi I2S modules - help needed.
« Reply #8 on: February 11, 2014, 03:22:11 PM »

Just got an answer from Daniel, the author of the HiFiBerry modules:
Code: [Select]
DAC and Digi drivers are different. The DAC driver has no idea about the hardware itself. The Digi driver has to initialize the hardware by I2C. This does not seem to work in your setup..

So now I'm testing whether the card is dead or not. Next I will need to figure out what to do.

Steen

I looked at the driver during lunch today, it is definitely probing the card.    Do you have a Hifiberry_Dac that you could put on to test your i2c bus on the RPi.  If the RPi is working, then it must be something witht he Digi board.

Offline sbp

  • Sr. Member
  • ****
  • Posts: 429
    • piCorePlayer homepage
Re: support for HiFiBerry Digi I2S modules - help needed.
« Reply #9 on: February 11, 2014, 03:55:02 PM »
I definitely think the card is dead. I just downloaded a test image with a full raspbian from the hifiberry digi web page, and it produces the same errors during booting.

So I will need a replacement card.

Thanks for looking into this

Steen

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1251
Re: support for HiFiBerry Digi I2S modules - help needed.
« Reply #10 on: February 11, 2014, 04:42:38 PM »
I definitely think the card is dead. I just downloaded a test image with a full raspbian from the hifiberry digi web page, and it produces the same errors during booting.

So I will need a replacement card.

Thanks for looking into this

Steen

I'm assuming that you inspected your solder connections.   I've done quite a bit of soldering, and these cards were a little trickier to solder than most.

Offline sbp

  • Sr. Member
  • ****
  • Posts: 429
    • piCorePlayer homepage
Re: support for HiFiBerry Digi I2S modules - help needed.
« Reply #11 on: March 08, 2014, 10:04:25 AM »
Hi all.

I have got a new HiFiBerry Digi card and therefore would like to be able to use it in microcore (piCorePlayer). The first card I received was faulty, but the new one is working fine in raspbian, but unfortunately it is not working in microcore.


This is what is loaded at start:
Code: [Select]
sudo modprobe snd_soc_bcm2708
sudo modprobe snd_soc_bcm2708_i2s
sudo modprobe bcm2708_dmaengine
sudo modprobe snd_soc_wm8804
sudo modprobe snd_soc_hifiberry_digi

This is lsmod:
Code: [Select]
tc@piCorePlayer:~$ lsmod
Module                  Size  Used by    Not tainted
bcm2708_dmaengine       5104  0
virt_dma                2021  1 bcm2708_dmaengine
snd_soc_hifiberry_digi     2572  0
snd_usb_audio         116218  0
snd_usbmidi_lib        18720  1 snd_usb_audio
snd_rawmidi            20133  1 snd_usbmidi_lib
snd_seq_device          6034  1 snd_rawmidi
snd_hwdep               5917  1 snd_usb_audio
snd_bcm2835            16116  0
8192cu                550984  0
snd_soc_bcm2708_i2s     5486  0
snd_soc_wm8804          7692  0
snd_soc_core          115066  3 snd_soc_hifiberry_digi,snd_soc_bcm2708_i2s,snd_soc_wm8804
snd_pcm_dmaengine       4564  1 snd_soc_core
snd_pcm                74840  4 snd_usb_audio,snd_bcm2835,snd_soc_core,snd_pcm_dmaengine
snd_page_alloc          4680  1 snd_pcm
snd_timer              19270  1 snd_pcm
snd_compress            7974  1 snd_soc_core
snd                    56397 10 snd_usb_audio,snd_usbmidi_lib,snd_rawmidi,snd_seq_device,snd_hwdep,snd_bcm2835,snd_soc_core,snd_pcm,snd_timer,snd_compress
regmap_i2c              1522  2 snd_soc_wm8804,snd_soc_core
regmap_spi              1778  2 snd_soc_wm8804,snd_soc_core
regmap_mmio             2673  1 snd_soc_bcm2708_i2s

This is the output from dmesg in the interesting area:
Code: [Select]
[   30.550406] wm8804 1-003b: revision E
[   30.551879] bcm2708-i2s bcm2708-i2s.0: Missing dma channel for stream: 0
[   30.551914] bcm2708-i2s bcm2708-i2s.0: ASoC: pcm constructor failed: -22
[   30.551936] snd-hifiberry-digi snd-hifiberry-digi.0: ASoC: can't create pcm HifiBerry Digi HiFi :-22
[   30.551953] snd-hifiberry-digi snd-hifiberry-digi.0: ASoC: failed to instantiate card -22
[   30.552213] snd-hifiberry-digi snd-hifiberry-digi.0: snd_soc_register_card() failed: -22
[   30.552249] snd-hifiberry-digi: probe of snd-hifiberry-digi.0 failed with error -22

And no digital soundcard is found:
Code: [Select]
tc@piCorePlayer:~$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device

*******************************************
The following is from Raspbian were it is working:

This is dmesg from a working raspbian
Code: [Select]
5.046655] bcm2708_i2c_init_pinmode(0,0)
[    5.189238] bcm2708_i2c_init_pinmode(0,1)
[    5.198487] bcm2708_i2c bcm2708_i2c.0: BSC0 Controller at 0x20205000 (irq 79) (baudrate 100000)
[    5.565192] bcm2708_i2c_init_pinmode(1,2)
[    5.683164] bcm2708_i2c_init_pinmode(1,3)
[    5.759676] bcm2708_i2c bcm2708_i2c.1: BSC1 Controller at 0x20804000 (irq 79) (baudrate 100000)
[    6.592136] bcm2708-i2s bcm2708-i2s.0: Failed to create debugfs directory
[   17.463406] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   17.979715] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   19.047572] wm8804 1-003b: revision E
[   19.061571] snd-hifiberry-digi snd-hifiberry-digi.0:  wm8804-spdif <-> bcm2708-i2s.0 mapping ok


And it finds the digital card:
Code: [Select]
aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpihifiberry
    snd_rpi_hifiberry_digi,
    Default Audio Device
sysdefault:CARD=sndrpihifiberry
    snd_rpi_hifiberry_digi,
    Default Audio Device

And this is the loaded modules:
Code: [Select]
pi@raspberrypi ~ $ lsmod
Module                  Size  Used by
snd_soc_hifiberry_digi     2556  0
bcm2708_dmaengine       5108  2
virt_dma                2273  1 bcm2708_dmaengine
snd_soc_wm8804          7821  1
snd_soc_bcm2708_i2s     5474  2
regmap_mmio             2806  1 snd_soc_bcm2708_i2s
snd_soc_core          131268  3 snd_soc_wm8804,snd_soc_hifiberry_digi,snd_soc_bcm2708_i2s
snd_compress            8076  1 snd_soc_core
regmap_i2c              1645  2 snd_soc_wm8804,snd_soc_core
regmap_spi              1897  2 snd_soc_wm8804,snd_soc_core
snd_pcm                81593  1 snd_soc_core
snd_page_alloc          5156  1 snd_pcm
snd_seq                53769  0
snd_seq_device          6473  1 snd_seq
snd_timer              20133  2 snd_pcm,snd_seq
leds_gpio               2059  0
evdev                   9419  1
led_class               3688  1 leds_gpio
snd                    61291  6 snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress
i2c_bcm2708             3997  0


I have tried to load the modules in different order, but somehow microcore can't use the digital sound card. I'm suspecting that it might have something to do with the i2c modules, but I really don't know??

Steen
« Last Edit: March 08, 2014, 10:27:53 AM by sbp »

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: support for HiFiBerry Digi I2S modules - help needed.
« Reply #12 on: March 08, 2014, 11:14:15 AM »
Which piCore version are you using? Also please share the complete dmesg files, not only parts.
« Last Edit: March 08, 2014, 12:33:56 PM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: support for HiFiBerry Digi I2S modules - help needed.
« Reply #13 on: March 08, 2014, 12:24:44 PM »
With piCore you have the bcm_2835 and usb audio modulos loaded, with Raspbian they are not loaded. Is there any change if they are not loaded?
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline sbp

  • Sr. Member
  • ****
  • Posts: 429
    • piCorePlayer homepage
Re: support for HiFiBerry Digi I2S modules - help needed.
« Reply #14 on: March 09, 2014, 04:33:26 AM »
Good morning bmarcus.

Thank you for your thoughts about the problem. Based on this I tried various things and with your newest piCore5.2 I think that I can get it to work. I need to try a few times more in order to get it right, but it seems possible.

But now I have a really silly question. Somehow I defined /mnt/sda1/tce as my tce directory.  But I want it to be /mnt/mmcblk0p2/tce, and I can't figure out how to change that?

Using tce-setdrive state that it is already defined.

Steen