Today I started with the first HiFiBerry Digi tests. Unfortunately the PCB had some major problems. But with some bent pins and additional cables I was able to get the board running. I was also able to output sound already via the optical SPDIF output. That means, the development can go on. I will start developing the Linux driver for the board now. It is a bit more complex than the driver for the HiFiBerry Mini, because it needs I2C communication to configure the chipset correctly. However, I don’t expect major problems here. Stay tuned!
There was still a minor bug in the input section of the HiFiBerry DSP Light prototype. It was just a resistor that was soldered only on one side. After fixing this bug, the board it now working correctly. That means we have a DSP board that can be programmed from the Raspberry Pi and has analog inputs and outputs. I usually do the basic tests using a signal generator and the oscilloscope. However, a simple sine wave is a boring subject for a DSP. Simple biquad filters do not modify the waveform. But let’s see, what happens if we use the abs() function on a sine wave:
Oops, the signal is inverted. But this is not an issue, inverting a signal in the DSP is a trivial function.
That means we can now focus on the software development. The first step is the EEPROM functionality. With the onboard EEPROM the DSP works even without the Raspberry Pi (however without the option to control it over the network).
The next step will be a universal filter designer that can be used for crossovers, equalizing and even room equalization. The software will be open source. Are you interested to join the software development team? Contact us!
After some hours of debugging and fixing a hardware problem, the DSP hardware seems to work now.
There are still cables soldered for I2C debugging purposes, but writing to the DSP works without problems now. I still have to work on reading data back from the DSP. Therefore the debug cables are still soldered. You also see, that the voltage regulator at the bottom is not used yet. I will do some comparison tests with a separate voltage regulator for the analog circuit.
I created a simple DSP program that generated different waveforms on the different output. Let’s see what happens on the output:
Looks good! The DSP now runs at 48kHz, therefore the triangle waveform is not exactly a triangle. But that’s what you would expect.
Our DSP project for the Raspberry Pi has reached the next milestone: hardware prototyping. The digital part of the circuits is working. There was still a minor bug (wrong pinout of a transistor) that was easy to correct by soldering the transistor on its back. The rest of the circuit worked well. As you can see on the picture, the analog part is not assembled yet. First I want to be able to upload the software to the chip.
Unfortunately, the simple approach to upload the program did not work. The chip simply did not acknowledge any I2S requests. Soldering some cables and connecting the I2S bus to the logic analyzer showed some unexpected behavior. While I2C read requests did not work, there was no problem with write requests. What happened? I had a look at the datasheet again and I think, I found the problem. Before every read request, the chip expects a write request with the address to read. However, both requests have to be in the same I2C transaction. The chip expects multiple start bits. Unfortunately, the Python I2C library that I wanted to use does not support multiple starts. It seems that I have to use the lower-level device driver of the operating system to upload the software to the chip.
Here are some noise and distortion measurements of the HiFiBerry Mini DAC. Without the ethernet connected, noise is practically non-existing. But also distortions look good. D2 has the highest level and higher-order noise is decreasing with each order. This is really a nice chip.
At 1kHz we see 0.0037% THD+N (distortions alone only 0.003%). However, the measurement equipment itself (an EMU0404) itself has a THD+N level of 0.002% at this frequency (in- and output together). Therefore the real noise and distortion figure might even be a bit smaller.
We also did tests at other frequencies and they look similar:
Note, that these measurements are a bit flawed, because at higher frequencies there are less harmonics within the measurement frequency range than at lower frequencies. Therefore the distortions go down. Unfortunately I was not able the extract the D2 and D3 levels alone.
There are more good news. The voltage regulation on the board works great. Even with the worst power supply I could find (a Nokia charger), the figures did not change much. THD+N went up from 0.0037% to 0.004% at 1kHz. That means there is no urgent need to upgrade the power supply of your Raspberry Pi.
Update 1.12.2013: We did some THD+N measurements of our production version. They were even lover than the values show here.
Many PCBs have a large ground plane where most components connect to. In simple microcontroller circuits, this usually works well. But for complex and mixed analog/digital circuits, you need to think a bit more how to route your ground traces. If you want to design your own PCB, have a look at this tutorial document from Analog Devices.
The PCM5102 is a nice I2S DAC. We use it in you HiFiBerry Mini DAC. It is easy to use, because it does not need a master clock and can run on a single 3.3V power supply. To generate a full 2Vrms signal, the chip uses an internal charge pump (with two external 2.2uF capacitors) to generate a negative power supply.
Unfortunately the datasheet gives no information about the switching frequency of the charge pump. But it’s not a secret. You can simply have a look on the voltage on the external capacitor. What do we see? Switching frequency is about 850kHz – way out of the audible frequency range.
Update 13.11.13: It seems, that the charge pump frequency depends on the sample rate. We’ve seen even charge pump frequencies above 1MHz.
There are many mixed analog/digital circuits today. Often the components like ADCs, DACs or codecs have separate power supply pins for analog and digital parts of the circuit. However, most modern opamp-based circuits have a very high power supply rejection ratio (PSSR). Does it really make sense to use separate power supplies for the analog and the digital part?
Let’s have a look at a specific example – our HiFiBerry USB. The PCM2906C from Texas Instruments used in this design can be powered completely from the USB bus. It has internal voltage regulators the create a 3.3V voltage supply from the USB bus voltage. But if you look in the datasheet, you will notice that Texas Instruments recommends an external REG-103 voltage regulator for high-quality audio.
Is there really a difference? Let’s see. For our tests we measure harmonic distortions of both the input and the output of this codec. Input and output are connected by a simple loopback cable. Input and output run at full swing (about 2Vpp).
We will start without an external voltage regulator. The chip is powered directly from the USB bus power.
0.01% harmonic distortion (D2) are not too bad. This chip is not the best codec available on the market. However, there is a lot of D6+ distortion peaking to 0.1%. That doesn’t look good. Where does it come from? Let’s see, what happens if we use a REG-103 voltage regulator for the analog supply of the circuit:
Much better! D2 and D3 are at about 0.005%, D4+ even much lower. This is a really nice-performing codec now.
There is also another interesting fact here: Even with the additional voltage regulator, the whole circuit is still powered via the USB bus voltage. With a high-quality voltage regulator there is no need for an external power supply, which is good news.