Hifiberry Digi+ Pro with Allo Isolator


For quite some time I’m using the Allo Isolator for galvanic isolation between the Pi and the HifiBerry. Everything was upsampled to 192kHz and works great. No more cracks, deep dark sound.

Only when starting playing with different sample rates (44.1kHz based) MPD hangs. Before using the isolator it did work. If seems that something is wrong.

The HifiBerry Digi+ Pro has two crystals onboard; one for a multiplicity of 48kHz and one for multiplicity of 44.1kHz based sample rates. The crystal selection is done by using GPIO 5 & 6. Only GPIO 5 isn’t isolation by the Allo Isolator.

This can lead to two scenarios:

  • If the power supplies aren’t isolated (for example shared ground), it will work. Only your system isn’t isolated as it should.
  • If the power supplies are really isolated, GPIO 5 becomes floating. In my case this even damaged my crystal.

 The image below illustrate the difference between GPIO6 (pin31) and GPIO5 (pin29).

Isolated vs not Isolated pin

Fixing the isolation

Lets first take a look at the Isolator. In red is shown which pin is isolated by which isolation ICs (Si8630, Si8631 and Si8502). Each pin has a certain fixed role; output(>), input(<) or bidirectional (<>).

Allo Isolator IO Pins vs Isolator Electronics

Also not clear from the Isolator documentation is that the SPI isolating works different from the GPIO isolation; SPI isolation means no connection at all. Yes that is also isolated, but not usable.

For the clock selection we need an unused output pin. Below is an overview of how my system is using the Pi IO header.

Raspberry Pi Io Header usage

GPIO16 (pin 36 ) looks like a good match.

Only the HifiBerry can’t be configured to use a different pin. We could rework the Allo Isolator in such way that GPIO 6 is using isolation electronics from GPIO16 (and disconnect GPIO16 from the Pi).

Steps to reuse the GPIO16 isolation electronics:
– [bottom side] pin 29; cut trace to via
– [bottom side] pin 36; cut connector from the solder pad
– [bottom side] solder wire between pin 29 and pin 36 on the bottom side
– [upper side] solder wire between pin 29 and pin 36 on the bottom side

I choose a different approach, which only requires one electronical modification to the Isolator; break the connection between GPIO5 upper and lower connector of the Allo Isolator. The trick is that we will make software modification so that the HifiBerry software driver will use the already isolated GPIO16.

Steps to take:

  1. Electrical isolate GPIO5 upper and lower connector from the Allo Isolator.
  2. Connect GPIO5 to GPIO16 on the isolated side with a jumper wire.
  3. Create a software mod to use a different GPIO pin.

Isolated GPIO pin 5 from the Pi

First we have to make sure GPIO 5 (pin 29) is electrical isolated. On the bottom of the Isolator there is a via that connects GPIO5 from the bottom connector to the top connector. This via is connected with a very small trace going from to the solder pad of pin 29.

Just cut this trace with a small X-Acto knife or what ever for small knife you have. Probably you need to have some loupe of smartphone to see it clear enough, at least I did. You don’t need to remove the entire trace, just can scarf will do. Don’t forget to measure the connection between the upper and lower connector before and after to see if the cut is good enough. 

Connect GPIO 16 to GPIO 5

Next we have to connect from the Isolator upper connector GPIO 16 (pin 36) to GPIO 5. You can solder a wire between solder pads of pin 36 and pin 29 and you are good to go.
Because my HifiBerry has the additional male header installed, I did have another choice available; Just connect a jumper wire from pin 36 to pin 29 on the HifiBerry upper connector. No soldering required.

Jumper wire for connection between GPIO5 & GPIO16

Do you notice the connector in position P3? You can use this one to feed both the HifiBerry and the Isolator with clean 5V. In this way you can avoid the less available 6.5V for the Isolator. Both the HB and Isolator use own regulators for 3.3V, which what the actual chips are using.

Make the Pi use GPIO 16 for clock selection

Let the Pi HifiBerry driver use an other GPIO for the crystal selection is standard not available. To make this work we need to change the driver overlay a bit.

This involves the steps:

  • create a new overlay that support reconfigure the clock selection GPIO
  • configure the Raspberry Pi to use it.

Create a new overlay

Luckily it isn’t hard to make a new overlay which allow to configure the used pins.
But you need to know a little about using the command line command of Linux. First login open a SSH session, for example with PuTTY.

Or alternative you can download the overlay here and just copy to the overlays directory on the SD card. It is build on Moode 6.4.2 with kernel 4.19.97-v7+ #1293.

  • Install the device tree compiler
sudo apt-get install raspi-gpio device-tree-compiler
  • Download the remap overlay source here or create a file called hifiberry-digi-pro-remap.dts
vi hifiberry-digi-pro-remap-overlay.dts
  • If not downloaded fill the content with:
// Definitions for HiFiBerry Digi Pro clock select remap
/dts-v1/;
/plugin/;

/{
 compatible = "brcm,bcm2835";


 fragment@0 {
  target = <&i2s>;
  __overlay__ {
   status = "okay";
  };
 };

 fragment@1 {
  target = <&i2c1>;
  __overlay__ {
   #address-cells = <1>;
   #size-cells = <0>;
   status = "okay";

   wm8804@3b {
    #sound-dai-cells = <0>;
    compatible = "wlf,wm8804";
    reg = <0x3b>;
    PVDD-supply = <&vdd_3v3_reg>;
    DVDD-supply = <&vdd_3v3_reg>;
    status = "okay";
   };
  };
 };

 fragment@2 {
  target = <&sound>;
  hifiberry_digi_pro: __overlay__ {
   compatible = "hifiberry,hifiberry-digi";
   i2s-controller = <&i2s>;
   status = "okay";
   clock44-gpio = <&gpio 5 0>;
   clock48-gpio = <&gpio 6 0>;
  };
 };

 __overrides__ {
  clock44_gpio_pin = <&hifiberry_digi_pro>,"clock44-gpio:4";
  clock48_gpio_pin = <&hifiberry_digi_pro>,"clock48-gpio:4";
 }; 

};
  • Compile this file with:
dtc -@ -I dts -O dtb -o hifiberry-digi-pro-remap.dtbo hifiberry-digi-pro-remap-overlay.dts
  • Copy it to the correct system location:
sudo cp hifiberry-digi-pro-remap.dtbo /boot/overlays/

Use the new overlay

Steps:

  • Open the file config.txt (/boot/config.txt) in editor.
  • search for the line dtoverlay=hifiberry-digi-pro
  • make it a comment by putting an # before it so it looks like:
#dtoverlay=hifiberry-digi-pro
  • Create a new line just below it with :
dtoverlay=hifiberry-digi-pro-remap,clock44_gpio_pin=16,clock48_gpio_pin=6 
  • Save the file an (re)boot the Pi

If you aren’t familiar with how to edit the file on the Pi with SSH, just remove the SD card an put the card in your normal computer.

If you want to be sure and check if the overlay is correctly loaded else then by playing aa 44.1kHz based file run from the SSH console:

sudo vcdbg log msg |& grep -v HDM

In the output the following lines should appear:

002107.626: dtdebug: Opened overlay file 'overlays/hifiberry-digi-pro-remap.dtbo'
002109.778: brfs: File read: /mfs/sd/overlays/hifiberry-digi-pro-remap.dtbo
002155.779: Loaded overlay 'hifiberry-digi-pro-remap'
002155.842: dtparam: clock44_gpio_pin=16
002156.047: dtdebug: Found override clock44_gpio_pin
002156.100: dtdebug:   override clock44_gpio_pin: cell target clock44-gpio @ offset 4 (size 4)
002156.569: dtparam: clock48_gpio_pin=6
002156.788: dtdebug: Found override clock48_gpio_pin
002156.841: dtdebug:   override clock48_gpio_pin: cell target clock48-gpio @ offset 4 (size 4)

Leave a Reply

Your email address will not be published.