![]() |
HifiBerry DAC2 HD support - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3) +--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7) +--- Thread: HifiBerry DAC2 HD support (/showthread.php?tid=3389) |
HifiBerry DAC2 HD support - mystic - 01-17-2021 Hi guys, Since last thread is closed and no solution was provided - I decided to spent couple of hours integrating brand new DAC from HiFiBerry into Moode. Later maybe someone will add it to source code or later I will try contribute this changes to project itself. It is working with current latest version - 7.01, but i think it will be also working with older versions as well. Source code lines numbers are related to current version 7.01 - but even you're working with older version you wont have any problem with finding them in code ![]() So, in order to make it work you need to: 1. Add new driver to moode Just like TookAFace suggested here but remove chip options (I'm not quite sure if there is a difference with or without these options. Since this is PCM1796 - I haven't seen any additional configuration needed like it was with PCM5122 (older boards like DAC+ PRO)) Code: sudo sqlite3 /var/local/www/db/moode-sqlite3.db " INSERT INTO cfg_audiodev (id, name, dacchip, chipoptions, iface, list, driver, drvoptions) VALUES (75, 'HiFiBerry DAC2 HD', 'Burr Brown PCM1796', '', 'I2S', 'yes', 'hifiberry-dacplushd', '');" 2. Now we need to edit playerlib.php file and add custom name for volume control and modify driver count Open editor with code: Code: sudo nano /var/www/inc/playerlib.php Volume control: Code: Line:2071 Drivers count (originally 78 - now 79): Code: Line:270 3. Generate new checksums After making changes we need to generate new checksum for both playerlib file and driver list. In moode there is table called cfg_hash with calculated values. After changes both checksums are no longer valid - so moode will break. Well, we might bypass this integrity check and save some time, but let's play with moode nicely;-) Generate new checksum for playerlib: Code: php -r 'echo md5(file_get_contents("/var/www/inc/playerlib.php"));' Store output - will be needed in a minute ;-) Should be md5 sum - something like: d717dc9bc46782b962467a57de3fcedb Generate new checksum for device list: Create a file with devices in same way like moode does and store it in temporary folder: Code: sudo sqlite3 /var/local/www/db/moode-sqlite3.db "SELECT * FROM cfg_audiodev WHERE drvoptions NOT IN ('slave', 'glb_mclk') AND chipoptions = ''" > /tmp/moode-devices.txt Code: php -r 'echo md5(file_get_contents("/tmp/moode-devices.txt"));' Store output 4. Modify checksums ind DB There is a trigger in db which blocks any operation on cfg_hash table so we gonna remove it, modify table and recreate trigger (if you skip last part (recreation of trigger) then integrity check will fail in schema check). 4.1 Remove trigger: Code: sudo sqlite3 /var/local/www/db/moode-sqlite3.db "DROP TRIGGER ro_columns" 4.2 Modify checksums in db Change PASTE_GENERATED_OUTPUT_HERE to your generated checksum for playerlib.php: Code: sudo sqlite3 /var/local/www/db/moode-sqlite3.db "UPDATE cfg_hash SET value='PASTE_GENERATED_OUTPUT_HERE' WHERE id=10" Change PASTE_GENERATED_OUTPUT_HERE to your generated checksum for devices list: Code: sudo sqlite3 /var/local/www/db/moode-sqlite3.db "UPDATE cfg_hash SET value='PASTE_GENERATED_OUTPUT_HERE' WHERE id=8" 4.3 Recreate a trigger Code: sudo sqlite3 /var/local/www/db/moode-sqlite3.db "CREATE TRIGGER ro_columns BEFORE UPDATE OF param, value, [action] ON cfg_hash FOR EACH ROW BEGIN SELECT RAISE(ABORT, 'read only'); END" 5. Reboot raspberry Code: sudo reboot Now - just select new driver in Audio Options and enjoy music;-) RE: HifiBerry DAC2 HD support - TeronG - 01-18-2021 That's great! It would be nice to have this integrated in 7.1.0 or even earlier ![]() RE: HifiBerry DAC2 HD support - Marrahm - 01-21-2021 'I’m running the latest version of Moode. When I copy and paste the first code paragraph, I get the following error:Error: UNIQUE constraint failed: cfg_audiodev.idSuggestions? thanks RE: HifiBerry DAC2 HD support - DRONE7 - 01-21-2021 @Marrahm please, don't re-post the whole how-to. Just ask your question. :-) RE: HifiBerry DAC2 HD support - mystic - 01-21-2021 (01-21-2021, 12:47 AM)Marrahm Wrote: 'I’m running the latest version of Moode. When I copy and paste the first code paragraph, I get the following error:Error: UNIQUE constraint failed: cfg_audiodev.idSuggestions? thanks That's because id which is specified here (75) is already present in db. So I might made a typo here or you already have such entry in db. Check what you have under 75. To do that use select statement like: Code: sudo sqlite3 /var/local/www/db/moode-sqlite3.db "SELECT * FROM cfg_audiodev" RE: HifiBerry DAC2 HD support - Marrahm - 01-21-2021 Mystic, Thanks - I’ll give that a shot. In playing around, there might be an easier way. I followed these instructions: https://www.hifiberry.com/docs/software/configuring-linux-3-18-x/ If you’re using the latest Moode with a 5.4+ kernel, make sure to add the force eeprom read option off. I still do not see the HD in the I2S setup options in Moode, but it doesnt’ seem to matter. Spotify works, airplay works, internet radio, etc. Settign up NAS now to make sure that works as well. Mike RE: HifiBerry DAC2 HD support - Marrahm - 01-21-2021 Solution: **This is an alternate solution to that provided above by Mystic. No need to do both** ***This is for recent versions of Moode using Kernels 5.4x and after. See the reference if you must try something similar with earlier kernels*** 1: SSH into your moode box and sudo nano /boot/config.txt 2: comment out (add # to first character of line containing): dtparam=audio=on 3: Add following lines to the file: dtoverlay=hifiberry-dacplushd force_eeprom_read=0 4: Write out the file and reboot. 5: In MPD settings, make sure you can see the “dacplushd” DAC identifier. That’s it. You can reboot and do “aplay -l” to make sure it shows up correctly. For whatever reason, leaving the I2S setting to none in Moode still works fine for me. The HD dac is playing everythign correctly from all sources. Sounds great. Source: https://www.hifiberry.com/docs/software/configuring-linux-3-18-x/ Mike RE: HifiBerry DAC2 HD support - gregvds - 02-23-2021 Hi, first time posting here. Will this be incorporated into 7.1.0 or even earlier? Greg RE: HifiBerry DAC2 HD support - gregvds - 02-25-2021 Amazing :-)! It worked directly. Pay attention that the HiFiBerry DAC2 HD does not appear in the HifFiBerry group, but rather well at the end of the list (last position)! At first, I was lost not finding it ;-). Thank you very much Mystic and Marrahm RE: HifiBerry DAC2 HD support - Marrahm - 02-25-2021 Gregvds, Are you talking about the I2S list? If so, I’m curious how the DAC2HD appeared there at all if you used the method I laid out above. I don’t see the HD anywhere on the list so I leave the I2S blank, but do select the HD in the MPD settings (its the only option to choose from actually). How did you get it to appear in the list and does it make a difference whether you select it or not? Thanks, Mike |