Tag Archives: driver

HiFiBerry Digi Linux driver

tux_enhanced_penguin_linux_art-1979pxThere wasn’t any hardware development news in the last time. The reason for it was mostly that we spent time developing a Linux driver for our new HiFiBerry Digi S/PDIF output board. And finally the first working version is there. Getting around the mixer controls and the power management (we don’t need both) took us some time. I want to thank Florian Meier personally for the tips he gave during the driver development phase.

Do you want to test if you can compile it yourself? You can download the code from Github (the new driver is in the 3.10 branch).

I2S and HiFiBerry driver now in downstream Raspberry kernel

tux_enhanced_penguin_linux_art-1979pxFlorian did a great job making the I2S sound module ready for the official Raspberry Pi Linux kernel. It is now much easier to enable HiFiBerry DAC support.

If you use a Raspbian-based distribution, it is just a command:

sudo rpi-update

This will install the latest Linux kernel and it will have HiFiBerry support. That means: no need to compile your own kernel! After installing the kernel, there is still some minor work to do:

  1. Enable HiFiBerry in /etc/modules, by adding the following lines to this file:
    snd_soc_bcm2708
    snd_soc_bcm2708_i2s
    bcm2708_dmaengine
    snd_soc_pcm5102a
    snd_soc_hifiberry_dac
  2. Reboot

That’s it! After the reboot, you should see, that the sound card is enabled:
[email protected] ~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

Linux 3.10 support for HiFiBerry DAC

tux_enhanced_penguin_linux_art-1979px

Florian Meier successfully added support for the HiFiBerry DAC in Linux 3.10. The patched kernel is available on GitHub. The next step will be the integration in the mainstream Raspberry Pi kernel. This may still take time. However, we will provide the patched kernel for major distributions to make it easy for you to use HiFiBerry.

We’re working together with two major Linux distributions focussing on audio and media playback to get the HiFiBerry integrated into these distributions. We will announce these partners when we get their feedback, that HiFiBerry works out-of-the-box with the distribution.

Are you interested in becoming a software partner for HiFiBerry? Contact us!

Connecting a Raspberry Pi and an ADAU1701 DSP

It looks like a simple task – connect the Raspberry Pi with an external ADAU1701 DSP chip. Both features an I2S interface – just connect it. However, it is not that easy. The ADAU1701 can only work as a slave device on the I2S input. Why not just using the Raspberry Pi as the master? This also won’t work, because the Raspberry Pi can create the BCLK and LRCLK signal, but not a 256xFs master clock signal that is needed by the ADAU1701. Using a local master clock on the ADAU1701 and the I2S clock from the Raspberry Pi will also not work, because both clocks have to be synchronous. Looks like a bit more complexity is needed.

We use the following setup: An external frequency generator creates the 12.288 MHz master clock and a synchronous 3.072 MHz BCLK signal. This BCLK signal will be the master clock for the I2S output of the Raspberry Pi. From this clock signal, the Raspberry Pi creates the 48 kHz LRCLK signal. Why are we not creating this clock externally? Because we have only a 2 channel signal generator available in the lab. This needs some tweaking in the sound card driver.

The ingredients of this test setup are

  • Rigol DG4062 signal generator
  • Raspberry Pi
  • MiniDSP (our own DSP board is not ready yet)
  • Lab power supply

For measurements I use a Rigol DS2072 DSO and a Intronix Logicport Logic analyzer. That’s a lot of equipment to connect two simple devices:

raspberry-dsp-tests

I had serious trouble to get this setup running. The reason for this was a simple mistake: I switched BCLK and LRCLK. But during debugging I had another idea. The output of the ADAU1701 is an I2S master. That means it can be used also as the master clock for the input. With this setup – output BCLK and LRCLK connected to input BCLK and LRCLK, there is no need for an external clock source. The ADAU1701 can create all the necessary clocks with the onboard resonator. This will simplify our DSP project a lot.

Finally when everything worked, it looked like this on the oscilloscope: a nice analog output from the ADAU1701.
adau1701-out

Adventures in I2S country

After getting I2S sound output running on the Raspberry Pi, I started communications with an ADAU1701. The chip has no sample rate converter (ASRC) integrated, therefore I had to configure the Raspberry Pi to output 48kHz I2S with BCLK=64*FS. I used the TDA1541A module, because it did exactly what I was looking for – at least at 44.1kHz.

raspberry_i2s-44

However, when I switched to 48kHz, the I2S output changed. What happend? At 48kHz, the I2S bit clock was only 32*FS, not 64*FS anymore. It looks like a feature of the driver. This needs further investigations. I might have to create a special driver, that only enables 48kHz with BCLK=64*FS.

raspberry_i2s-48

Update: I had a look in the driver code. Looks like there is a bug in the driver. I did a short hack to fix this temporarily, now it looks good:

raspberry_i2s-48-fixed

Unfortunately the ADC produces only noise. I have to investigate if there is a problem with the I2S data stream or if the signal quality is to poor to interpret the data correctly.

 

High resolution sound with the Raspberry Pi using I2S

raspberry-piOur HiFiBerry project is still ongoing. The PCB design is almost finalized and we expect the device to be ready in about 4-6 weeks. With HiFiBerry you will get an inexpensive and high-quality sound card for the Raspberry Pi. However, there is one thing it cannot provide: high-resolution sound, that means sampling frequencies above 48kHz are not supported. There are a lot of Pros and Cons for or against higher samples rates than 48kHz. At least when it comes to post processing like equalizing or digital crossovers, higher samples are a good idea.

You could also add an external USB sound card. But we are looking for a real DIY solution ;-) The 2nd revision of the Raspberry Pi provides access to the I2S pins of the processor. You can add an I2S capable ADC or DAC on these pins.

Unfortunately, the Linux kernel of the standard Raspberry Pi  does not support devices connected to the I2S pins. Therefore you need to compile your own kernel. Check out the “Noise is good” blog for more information. Hmm, looks like an interesting project for another Raspberry add-on board. We will have a look into this.

Link

AxiDriver - Examples - Dome - Field 10kHzYou want to simulation the effect of horns and waveguides on a speaker design? Check out the software from Randteam.de. It uses lumped element models for acoustics modeling. This is not a “plug-and-play” software where you simply insert your horn design and click “run”. It will need at least some  training, but the results seem to match reality quiet well.

There is a free version that does not allow saving. The commercial version of ABEC2 that is still in work.