Pi>DAC! - IQaudIO
Transcription
Pi>DAC! - IQaudIO
! ! ! Dear!customer,!! ! thank!you!for!purchasing!one!of!our!IQaudIO!products.!! ! This!document!covers!both!Pi>DAC!/!Pi>CASE!for!the!Raspberry!Pi! AND!Pi>DAC+!/!Pi>CASE+!for!the!Raspberry!Pi!B+.! ! If!there!is!something!missing!which!you!would!like!to!see!added! [email protected]! ! Yours!sincerely,! ! The!IQaudIO!team! ! ! ! Pi>DAC!is!covered!from!page!2! ! Pi>DAC+!is!covered!from!page!21! ! ! ! ! IQaudIO.com!Pi>DAC!/!Pi>CASE!instructions! (For!Raspberry!Pi!B)! # This#document#covers#the#following#tasks:# 1) Connection#of#the#IQaudIO.com#PiEDAC#onto#your#Raspberry#Pi# 2) Building#the#Raspberry#Pi#/#PiEDAC#into#your#PiECASE# 3) Updating#Raspbian#from#the#Raspberry#Pi#to#include#PiEDAC#support# 4) The#cross#compilation#of#the#Linux#Kernel#to#support#the#PiEDAC# 5) Obtaining#audio#from#the#Raspberry#Pi#through#the#PiEDAC# 6) Common#Linux#distribution#configurations# 7) Extreme#hacking#(Raspberry#Pi#Pins)# 8) Physical#details# # # 1) Connection!of!the!IQaudIO.com!Pi>DAC!onto!your!Raspberry!Pi! # WARNING:#ENSURE#YOU#HAVE#DISCONNECTED#YOUR#RASPBERRY#PI#FROM#POWER# BEFORE#ATTEMPTING#THIS#PROCEDURE# # The#PiEDAC#requires#the#supplied#female#2x4#header#to#be#soldered#to#the#Raspberry#Pi#on#the# top#side#P5#holes#–#as#indicated#by#the#pictures#below.## # If#your#Raspberry#Pi#has#already#had#a#different#header#soldered#in#place#it#should#be#removed# from#the#Raspberry#Pi#or#an#alternative#Raspberry#Pi#should#be#used#for#the#PiEDAC.# # Once#fitted#the#Raspberry#Pi#should#look#as#below# # v8#28/9/2014# # # # # 2# # # # The#12mm#PCB#standoff#should#then#be#screwed#to#the#PiEDAC.## # # # Once#secure#the#PiEDAC#should#be#pressed#onto#the#Raspberry#Pi’s#2x13#I/O#header#and#P5# header#and#the#PCB#standoff#should#be#screwed#to#the#Raspberry#Pi#itself.# # # v8#28/9/2014# # # # # # # # 3# Apply#power#to#your#Raspberry#Pi#in#the#normal#way.##You#should#see#that#the#Raspberry#Pi# and#the#IQaudIO.com#PiEDAC#both#have#power#LEDs#–#this#indicates#that#the#power#is# successfully#being#applied#to#the#PiEDAC.## # # You#can#now#remove#power#and#reconnect#any#necessary#peripherals#you#may#need.# # # # v8#28/9/2014# # # # # 4# 2) Building!the!Raspberry!Pi!/!Pi>DAC!into!your!Pi>CASE! # The#following#may#prove#helpful#when#building#your#PiECASE.## # a)#First,#if#you#are#using#the#PiEDAC#spacer#and#screws#have#these#connected#already.#Then#lay# out#the#sides#corresponding#to#the#Raspberry#Pi#/#PiEDAC#PCB.## # b)#Then,#build#the#sides#up#around#the#Raspberry#Pi.# # # v8#28/9/2014# # # # # # # # 5# c)#Add#the#top#(without#text)## # # d)#Carefully#flip#the#combination#on#its#top#allowing#you#to#add#the#PiECASE#base# # # v8#28/9/2014# # # # # # # 6# e)#PiECASE#base#in#place# # # f)#Now#add#the#4#nuts#and#bolts#–#Do#not#over#tighten,#finger#tight#is#OK# # # v8#28/9/2014# # # # # # # 7# g)#Completed#PiECASE#with#Raspberry#Pi#and#PiEDAC#inside# # v8#28/9/2014# # # # # # # 8# 3) Updating!Raspbian!from!the!Raspberry!Pi!to!include!Pi>DAC!support! ! This#guide#assumes#you#are#using#the#Raspbian#(Debian#Wheezy)#distribution#from#here:# http://www.raspberrypi.org/downloads/#and#that#you#have#an#SD#card#flashed#with# Raspbian#and#have#a#login#to#your#Raspberry#Pi#(either#local#or#via#ssh).#You#should#have#also# run#raspiEconfig#and#expanded#the#filesystem#to#occupy#your#full#SD#card.# # • Update#the#Raspbian#on#the#SD#card#to#be#the#latest#available.# # • # pi@raspberrypi ~ $ sudo rpi-update You#must#enable#i2C#support#for#the#PiEDAC#to#operate.#On#the#Raspberry#Pi#check#if#you# have#the#following#file#and#if#so#delete#the#line#containing#i2cEbcm2708.# pi@raspberrypi ~ $#sudo nano /etc/modprobe.d/raspi-blacklist.conf Delete#the#line#containing#the#text#below#if#it#exists# # # • # blacklist i2c-bcm2708 To#ensure#that#the#necessary#kernel#modules#are#loaded#at#boot,#you#must#add#the# following#lines#to#/etc/modules# pi@raspberrypi ~ $#sudo nano /etc/modules snd_soc_bcm2708 snd_soc_bcm2708_i2s bcm2708_dmaengine # • snd_soc_pcm512x snd_soc_iqaudio_dac Flush#your#filesystem#changes#and#reboot#the#Raspberry#Pi# pi@raspberrypi ~ $#sync pi@raspberrypi ~ $#sudo reboot # Once#restarted#SSH#into#the#Pi#and#check#that#the#audio#drivers#/#card#is#available#to#ALSA.# # pi@raspberrypi ~ $ aplay -l # If#the#IQaudIO.com#PiEDAC#and#drivers#have#been#installed#correctly#you#should#see# something#similar#to:# # pi@raspberrypi#~#$#aplay#El# ****#List#of#PLAYBACK#Hardware#Devices#****# card#0:#sndrpiiqaudioda#[snd_rpi_iqaudio_dac],#device#0:#IQaudIO#DAC#HiFi#pcm512xEhifiE0#[]# ##Subdevices:#1/1# ##Subdevice##0:#subdevice##0# # # # v8#28/9/2014# # # # # 9# # 4) The!cross!compilation!of!the!Linux!Kernel!to!support!the!Pi>DAC! # This#section#assumes#you#understand#the#cross#compilation#build#process#and#the#transfer#of#a# generated#Linux#kernel#and#modules#to#the#Raspberry#Pi.#This#is#for#advanced#users#only.# # If#you#would#rather#update#Raspbian#directly#on#the#Pi#(see#section!2#above)#or#take#a#preE configured#image#(see#section#5)#later#in#this#document.# # The#Raspberry#Pi#Linux#source#(https://github.com/raspberrypi/linux/tree/rpiE3.14.y)#now#contains# builtEin#support#for#the#IQaudIO.com#PiEDAC.#The#following#instructions#are#based#around#this# source.# # • Create#a#suitable#directory...# # From#your#Linux#PC,#make#suitable#build#directories:## # • gordon@BuildPC ~ $#mkdir ~/linux_iqaudio gordon@BuildPC ~ $#mkdir ~/linux_iqaudio/modules gordon@BuildPC ~ $#cd ~/linux_iqaudio Point#to#your#cross#compile#toolchain#(your#setup#may#be#different)#and#set#variables# gordon@BuildPC ~ $#export CCPREFIX=/home/gordon/tools/arm-bcm2708/gcclinaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihfOR gordon@BuildPC ~ $#export CCPREFIX=/usr/bin/arm-linux-gnueabigordon@BuildPC ~ $#KERNEL_SRC=~/linux_iqaudio/linux # • gordon@BuildPC ~ $#MODULES_TEMP=~/linux_iqaudio/modules/ Clone#the#source# gordon@BuildPC ~ $#git init # • • gordon@BuildPC ~ $#git clone https://github.com/raspberrypi/linux.git Now’s#a#good#time#for#a#tea#break#–#the#duration#will#depend#on#your#internet#connection# and#your#PC’s#performance.# # Build#the#system# gordon@BuildPC ~ $#cd ~/linux_iqaudio/linux gordon@BuildPC ~ $#make mrproper gordon@BuildPC ~ $#make ARCH=arm bcmrpi_defconfig gordon@BuildPC ~ $#ARCH=arm CROSS_COMPILE=${CCPREFIX} make menuconfig # v8#28/9/2014# # # # # # 10# After#menuconfig#is#built#it#should#auto#run#and#you#will#be#presented#with#a#range#of# menus,#to#ensure#that#the#IQaudIO.com#PiEDAC#is#enabled#follow#the#screenshots# below…# # # Scroll#down#and#select#Device#Drivers…# # # # Select#Sound#Card#Support# # v8#28/9/2014# # # # # 11# # And#then#Advanced#Linux#Sound#Architecture#(ALSA)# # Then#ALSA#for#SoC#(system#on#chip)#audio#support# # Select#“Support#for#IQaudIOEDAC”#and#then#Exit# # # # # # # # v8#28/9/2014# # 12# Keep#selecting#Exit#until#you#reach#the#following#prompt…,#select#Yes#to#save#and#exit.# # # # Now#build#the#Linux#kernel#based#on#your#selection.# # • # gordon@BuildPC ~ $#ARCH=arm CROSS_COMPILE=${CCPREFIX} make -j6 Once#complete,#check#that#the#Codec#and#IQaudIO.com#PiEDAC#drivers#have#been#build.## gordon@BuildPC ~ $ ls –l sound/soc/codecs/pcm512* -rw-rw-r-- 1 gordon gordon 17432 Apr 6 14:23 sound/soc/codecs/pcm512x.c -rw-rw-r-- 1 gordon gordon 5692 Apr 6 14:23 sound/soc/codecs/pcm512x.h -rw-rw-r-- 1 gordon gordon 14768 Apr 6 14:46 sound/soc/codecs/pcm512x.o # gordon@BuildPC ~ $ ls –l sound/soc/bcm/iqaudio* -rw-rw-r-- 1 gordon gordon 3118 Apr 6 14:23 sound/soc/bcm/iqaudio-dac.c -rw-rw-r-- 1 gordon gordon 4856 Apr 6 14:46 sound/soc/bcm/iqaudio-dac.o • # Build#the#modules#and#delete#the#unnecessary#links# gordon@BuildPC ~ $#ARCH=arm CROSS_COMPILE=${CCPREFIX} INSTALL_MOD_PATH=${MODULES_TEMP} make modules_install • Once#complete,#check#that#the#modules#have#been#build#as#expected…# gordon@BuildPC ~ $ ls -l sound/soc/codecs/snd* -rw-rw-r--rw-rw-r--rw-rw-r--rw-rw-r-- 1 1 1 1 gordon gordon gordon gordon gordon 18456 Apr 10 15:08 gordon 2911 Apr 10 15:06 gordon 4416 Apr 10 15:08 gordon 14784 Apr 10 14:46 sound/soc/codecs/snd-soc-pcm512x.ko sound/soc/codecs/snd-soc-pcm512x.mod.c sound/soc/codecs/snd-soc-pcm512x.mod.o sound/soc/codecs/snd-soc-pcm512x.o gordon@BuildPC ~ $ ls -l sound/soc/bcm/snd* -rw-rw-r--rw-rw-r--rw-rw-r--rw-rw-r--rw-rw-r--rw-rw-r--rw-rw-r--rw-rw-r-- • 1 1 1 1 1 1 1 1 gordon gordon gordon gordon gordon gordon gordon gordon gordon 11591 Apr 10 15:08 sound/soc/bcm/snd-soc-bcm2708-i2s.ko gordon 2033 Apr 10 15:06 sound/soc/bcm/snd-soc-bcm2708-i2s.mod.c gordon 3308 Apr 10 15:08 sound/soc/bcm/snd-soc-bcm2708-i2s.mod.o gordon 9029 Apr 10 14:46 sound/soc/bcm/snd-soc-bcm2708-i2s.o gordon 6532 Apr 10 15:08 sound/soc/bcm/snd-soc-iqaudio-dac.ko gordon 1208 Apr 10 15:06 sound/soc/bcm/snd-soc-iqaudio-dac.mod.c gordon 2408 Apr 10 15:08 sound/soc/bcm/snd-soc-iqaudio-dac.mod.o gordon 4870 Apr 10 14:46 sound/soc/bcm/snd-soc-iqaudio-dac.o Now#delete#the#unnecessary#symbolic#links#before#transferring#to#the#Pi…# gordon@BuildPC ~ $#rm ~/linux_iqaudio/modules/lib/modules/3.10.36+/source ## • gordon@BuildPC ~ $#rm ~/linux_iqaudio/modules/lib/modules/3.10.36+/build Make#the#kernel#image#(the#new#kernel.img#file#is#stored#in#this#mkimage#directory)# gordon@BuildPC ~ $##cd ~/tools/mkimage v8#28/9/2014# # # # # 13# # • # • gordon@BuildPC ~ $ ./imagetool-uncompressed.py ${KERNEL_SRC}/arch/arm/boot/zImage From#the#build#PC#copy#the#kernel#image#to#the#Pi's#home#directory#(here#the#Pi’s# IPAddress#is#10.0.0.13)# gordon@BuildPC ~ $#scp kernel.img [email protected]:. From#the#Pi,#copy#the#kernel#to#the#boot#directory# pi@raspberrypi ~ $#sudo cp /boot/kernel.img /boot/kernel.img.old # • # • pi@raspberrypi ~ $#sudo cp ~/kernel.img /boot/kernel.img From#the#Pi,#copy#the#modules#to#the#/boot/lib/#directory.#(Here#the#Build#PC’s#IPAddress# is#10.0.0.3)# pi@raspberrypi ~ $#sudo scp -r [email protected]:/home/gordon/linux_iqaudio/modules/lib/* /lib/. Flush#your#filesystem#changes#and#reboot#the#Raspberry#Pi# pi@raspberrypi ~ $#sync # • # pi@raspberrypi ~ $#sudo reboot You#must#enable#i2C#support#for#the#PiEDAC#to#operate.#On#the#Raspberry#Pi#check#if#you# have#the#following#file#and#if#so#delete#the#line#containing#i2cEbcm2708.# pi@raspberrypi ~ $#sudo nano /etc/modprobe.d/raspi-blacklist.conf Delete#the#line#containing#the#text#below#if#it#exists# # # • # blacklist i2c-bcm2708 To#ensure#that#the#necessary#kernel#modules#are#loaded#at#boot,#you#must#add#the# following#lines#to#/etc/modules# pi@raspberrypi ~ $#sudo nano /etc/modules snd_soc_bcm2708 snd_soc_bcm2708_i2s bcm2708_dmaengine # • snd_soc_pcm512x snd_soc_iqaudio_dac Flush#your#filesystem#changes#and#reboot#the#Raspberry#Pi# pi@raspberrypi ~ $#sync # # pi@raspberrypi ~ $#sudo reboot v8#28/9/2014# # # # # # 14# 5) Obtaining!audio!from!the!Raspberry!Pi!through!the!Pi>DAC! # Once#the#Linux#kernel#and#modules#have#been#copied#to#the#Raspberry#Pi#and#the#Linux# configuration#has#been#changed#to#include#the#loading#of#the#IQaudIO.com#PiEDAC#at#boot#you# should#now#be#able#to#listen#to#some#music.# # • Once#the#Raspberry#Pi#boots,#log#in#and#check#that#the#IQaudIO#PiEDAC#is#visible#as#an# ALSA#audio#card#by#running#aplay#–l,#the#output#should#be#similar#to#that#below.#Note#the# device#number#and#Subdevice#number#–#these#may#be#useful#to#you#when#configuring# media#applications#to#access#the#PiEDAC#in#your#system.# # pi@raspberrypi ~ $ aplay –l **** List of PLAYBACK Hardware Devices **** card 0: sndrpiiqaudioda [snd_rpi_iqaudio_dac], device 0: IQaudIO DAC HiFi pcm512xhifi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 # • Check#that#you#can#adjust#the#volume.#From#the#Raspberry#Pi#run#alsamixer.#If#you#have# more#than#one#sound#card#installed#you#may#have#to#select#which#is#being#controlled#by# pressing#the#F6#key.# # pi@raspberrypi ~ $ alsamixer # # Now#adjust#the#volume#by#highlighting#“Playback#Digital”##(Press#your#cursor#keys#left#and# right#to#select)#and#increase#/#decrease#the#volume#by#pressing#your#up#and#down#curson# keys.##Remember#+0dB#is#full#volume,#E23.5dB#is#mute!# # Set#the#volume#at#around#30%#and#from#another#terminal#(or#exit#from#alsamixer#first)# Test#that#audio#can#be#heard#through#the#PiEDAC.#Notice#the#hw#parameter#which#points#to# device#0,#sub#device#0#in#the#example#below.#Change#these#values#depending#on#the#output# of#the#aplay#–l#utility#above.# # v8#28/9/2014# # # # # 15# pi@raspberrypi ~ $ mplayer -ao alsa:device=hw=0,0 -nolirc http://stream.radioactive.fm:8000/ractive # # If#you#don’t#have#mplayer#already#installed:# # # pi@raspberrypi ~ $ sudo apt-get update # pi@raspberrypi ~ $ sudo apt-get install mplayer # If#you#are#unable#to#detect#the#PiEDAC#(using#aplay#–l)#or#alsamixer#doesn’t#show#any#IQaudIO# card#then#please#reEcheck#section#2#and#ensure#that#the#configuration#is#correct.#The#following# commands#may#help#you#during#debug:# # # pi@raspberrypi ~ $ dmesg … 6.549255] pcm512x 1-004c: No SCLK, using BCLK: -2 6.556344] sd 0:0:0:0: Attached scsi generic sg0 type 0 6.570452] pcm512x 1-004c: Completed initialisation - pcm512x_probe … [ 13.302381] snd-rpi-iqaudio-dac snd-rpi-iqaudio-dac.0: pcm512x-hifi <-> bcm2708i2s.0 mapping ok [ [ [ pi@raspberrypi ~ $ lsmod pi@volumio:~$ lsmod Module nfsd ipv6 snd_soc_iqaudio_dac bcm2708_dmaengine virt_dma snd_soc_pcm512x sg snd_soc_bcm2708_i2s regmap_mmio snd_soc_core regmap_spi snd_pcm snd_page_alloc regmap_i2c snd_compress v8#28/9/2014# # # # # Size 243497 304050 2493 5108 2273 8913 18996 5474 2806 131292 1897 81593 5156 1645 8060 Used by 2 36 0 1 1 bcm2708_dmaengine 1 0 2 1 snd_soc_bcm2708_i2s 3 snd_soc_pcm512x,snd_soc_iqaudio_dac,snd_soc_bcm2708_i2s 2 snd_soc_pcm512x,snd_soc_core 2 snd_soc_core,snd_soc_iqaudio_dac 1 snd_pcm 2 snd_soc_pcm512x,snd_soc_core 1 snd_soc_core 16# snd_seq snd_timer snd_seq_device leds_gpio led_class snd spi_bcm2708 i2c_bcm2708 53769 20133 6473 2059 3688 61291 4728 3997 0 2 1 0 1 6 0 0 snd_pcm,snd_seq snd_seq leds_gpio snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress # # # 6) Common!Linux!distribution!configurations! # Linux#based#audio#/#media#distributions#and#the#configuration#file#contents#are#listed#below.#If# you#have#other#information#you#would#like#to#see#added#to#this#documentation#then#please# email#[email protected]#with#the#specific#details.# # a. Volumio!(Thanks!to!tracer5)! ! # Volumio!1.3:! Since#13/6/2014,#Volumio#1.3#includes#the#necessary#Linux#modules#to#support#the#PiEDAC#but#does# need#a#simple#change#to#the#/etc/mpd.conf#file#allowing#hardware#volume#control.# # Once#you#have#selected#the#IQaudIO#PiEDAC#within#Volumio’s#system#settings#and#rebooted.#SSH# into#the#Pi#and#edit#/etc/mpd.conf#and#change#“PCM”#to#“Playback#Digital”#to#address#the#correct# mixer#control#of#the#IQaudIO.com#PiEDAC.#Remember#to#save,#sync#and#reboot#for#these#changes#to# take#effect.# # # audio_output#{# # #################type###########"alsa"# #################name###########"Output"# #################device#########"hw:0,0"# #################mixer_control##"Playback#Digital"# #################mixer_device###"hw:0"# #################mixer_index####"0"# #################dsd_usb########"yes"# }# # # # # The!following!instructions!are!for!versions!of!Volumio!PRIOR!to!v1.3:! # Start#with#downloading#the#latest#beta#from#the#Volumio#site:##Raspberry#Pi#Volumio1.2beta# # Write#image#file#to#SD#card;#boot#image#on#Raspberry#Pi;#ssh#to#pi# # Update#the#kernel#and#firmware# # To!update!packages:! # sudo apt-get update && sudo apt-get upgrade # To!update!kernel:! # sudo apt-get update && sudo apt-get -y dist-upgrade # Use!the!Hexxeh!script!to!install!the!rpi>update!tool:! v8#28/9/2014# # # # # 17# # sudo apt-get install rpi-update # sudo curl -L --output /usr/bin/rpi-update https://raw.github.com/Hexxeh/rpiupdate/master/rpi-update && sudo chmod +x /usr/bin/rpi-update # To!update!the!firmware:! # sudo rpi-update # Reboot!to!load!the!new!firmware.! sudo reboot # Get#the#name#and#configuration#of#the#updated#linux#kernel# # uname -a # Mine#is:####3.10.36+##664#PREEMPT# # Configure!Linux!to!load!the!IQaudIO!modules! Edit:#/etc/modules#to#look#like#this…# # snd_soc_bcm2708 snd_soc_bcm2708_i2s bcm2708_dmaengine snd_soc_pcm512x snd_soc_iqaudio_dac # # Ensure!the!changes!are!committed!to!the!SD!card!and!reboot! sync sudo reboot # The#Raspberry#Pi#with#IQAudIO#PiEDac#should#now#be#working.# # Note1:#In#MPD#System#settings#do#not#Activate#I2S#driver#as#it#will#overwrite#the#/etc/modules#file# with#the#HiFiBerry#values.# # Note2:#If#you#would#like#volume#control#then#edit#/etc/mpd.conf#to#address#the#correct#mixer# control#of#the#IQaudIO.com#PiEDAC#have#the#following#in#audio_output#section…# ## audio_output#{# # #################type###########"alsa"# #################name###########"Output"# #################device#########"hw:0,0"# #################mixer_control##"Playback#Digital"# #################mixer_device###"hw:0"# #################mixer_index####"0"# #################dsd_usb########"yes"# # }# # # ! ! # b. RuneAudio! ! Alpha#0.3#includes#support#for#the#IQaudIO.com#PiEDAC.## # v8#28/9/2014# # # # # 18# # 7) Extreme!hacking!(Raspberry!Pi!Pins)! # For#those#who#want#to#do#things#like#Power#the#PiEDAC#from#a#separate#power#source#than#the# Raspberry#Pi#itself#the#following#may#be#of#help#although#we#do#not#recommend#using#the#PiE DAC#in#this#way.# # The#following#Pi#Pins#need#to#be#connected#to#the#corresponding#PiEDAC#headers#for#audio#to# work.#We#recommend#that#the#other#Raspberry#Pi#ground#pins#are#also#connected.# # P1#(26way):# 3#(I2C#SDA)# 5#(I2S#SCL)## 17#(3.3v)# # P5#(8#way):# 1#(5v)# 2#(3.3v)# 4#(I2S#LRCK)# 6#(I2S#DATA)# 8#(GND)# # # # v8#28/9/2014# # # # # 19# # 8) Physical!Details! # For#those#who#need#to#know#the#physical#characteristics#/#positions#of#the#phono#connectors# when#connected#the#PiEDAC#is#connected#to#the#Raspberry#Pi.#(all#sizes#in#mm)# # # v8#28/9/2014# # # # # 20# ! IQaudIO.com!Pi>DAC+!/!Pi>CASE+!instructions! (For!Raspberry!Pi!B+)! # This#document#covers#the#following#tasks:# 1) Connection#of#the#IQaudIO.com#PiEDAC+#onto#your#Raspberry#Pi# 2) Building#the#Raspberry#Pi#/#PiEDAC+#into#your#PiECASE+# 3) Updating#Raspbian#from#the#Raspberry#Pi#to#include#PiEDAC+#support# 4) The#cross#compilation#of#the#Linux#Kernel#to#support#the#PiEDAC+# 5) Obtaining#audio#from#the#Raspberry#Pi#through#the#PiEDAC+# 6) Common#Linux#distribution#configurations#(and#ALSA#H/W#volume#control#name)# 7) Adding#the#optional#PIN#headers#to#the#PiEDAC+# # # 1) Connection!of!the!IQaudIO.com!Pi>DAC+!onto!your!Raspberry!Pi! # WARNING:#ENSURE#YOU#HAVE#DISCONNECTED#YOUR#RASPBERRY#PI#FROM#POWER# BEFORE#ATTEMPTING#THIS#PROCEDURE# # The#PiEDAC+#can#be#connected#to#the#Raspberry#Pi’s#40way#pin#header#without#any#additional# soldering.## # The#PiEDAC+#is#supplied#with#4x#PCB#spacers,#8x#screws#and#some#additional#OPTIONAL#I/O# pin#headers.## # # The#spacers#should#be#screwed#to#the#Raspberry#Pi#B+#before#adding#the#PiEDAC+.## # v8#28/9/2014# # # # # 21# # # Once#the#PiEDAC+#has#been#fitted#the#remaining#screws#can#be#tightened#as#required.## # # # Apply#power#to#your#Raspberry#Pi#in#the#normal#way.##You#should#see#that#the#Raspberry#Pi# and#the#IQaudIO.com#PiEDAC+#both#have#power#LEDs#–#this#indicates#that#the#power#is# successfully#being#applied#to#the#PiEDAC+.## # # You#can#now#remove#power#and#reconnect#any#necessary#peripherals#you#may#need.# # # # v8#28/9/2014# # # # # 22# 2) Building!the!Raspberry!Pi!/!Pi>DAC+!into!your!Pi>CASE+! # The#following#may#prove#helpful#when#building#your#PiECASE+.## # a)#First,#if#you#are#using#the#PiEDAC+#spacers#and#screws#have#these#connected#already.#Then# lay#out#the#sides#corresponding#to#the#Raspberry#Pi#/#PiEDAC+#PCB.## # # # # b)#Then,#build#the#sides#up#around#the#Raspberry#Pi.# # v8#28/9/2014# # # # # # # # 23# # c)#Add#the#top#(without#text)## # d)#Carefully#flip#the#combination#on#its#top#allowing#you#to#add#the#PiECASE+#base# # # v8#28/9/2014# # # # # # # # 24# e)#PiECASE+#base#in#place# # # Now#add#the#4#nuts#and#bolts#–#Do#not#over#tighten,#finger#tight#is#OK# # f)#Completed#PiECASE+#with#Raspberry#Pi#and#PiEDAC+#inside# # # # v8#28/9/2014# # # # # # # 25# 3) Updating!Raspbian!from!the!Raspberry!Pi!to!include!Pi>DAC+!support! ! This#guide#assumes#you#are#using#the#Raspbian#(Debian#Wheezy)#distribution#from#here:# http://www.raspberrypi.org/downloads/#and#that#you#have#an#SD#card#flashed#with# Raspbian#and#have#a#login#to#your#Raspberry#Pi#(either#local#or#via#ssh).#You#should#have#also# run#raspiEconfig#and#expanded#the#filesystem#to#occupy#your#full#SD#card.# # • Update#the#Raspbian#on#the#SD#card#to#be#the#latest#available.# # • # pi@raspberrypi ~ $ sudo rpi-update You#must#enable#i2C#support#for#the#PiEDAC+#to#operate.#On#the#Raspberry#Pi#check#if#you# have#the#following#file#and#if#so#delete#the#line#containing#i2cEbcm2708.# pi@raspberrypi ~ $#sudo nano /etc/modprobe.d/raspi-blacklist.conf Delete#the#line#containing#the#text#below#if#it#exists# # # • # blacklist i2c-bcm2708 To#ensure#that#the#necessary#kernel#modules#are#loaded#at#boot,#you#must#add#the# following#lines#to#/etc/modules# pi@raspberrypi ~ $#sudo nano /etc/modules snd_soc_bcm2708 snd_soc_bcm2708_i2s bcm2708_dmaengine # • snd_soc_pcm512x snd_soc_iqaudio_dac Flush#your#filesystem#changes#and#reboot#the#Raspberry#Pi# pi@raspberrypi ~ $#sync pi@raspberrypi ~ $#sudo reboot # Once#restarted#SSH#into#the#Pi#and#check#that#the#audio#drivers#/#card#is#available#to#ALSA.# # pi@raspberrypi ~ $ aplay -l # If#the#IQaudIO.com#PiEDAC+#and#drivers#have#been#installed#correctly#you#should#see# something#similar#to:# # pi@raspberrypi#~#$#aplay#El# ****#List#of#PLAYBACK#Hardware#Devices#****# card#0:#sndrpiiqaudioda#[snd_rpi_iqaudio_dac],#device#0:#IQaudIO#DAC#HiFi#pcm512xEhifiE0#[]# ##Subdevices:#1/1# ##Subdevice##0:#subdevice##0# # # # v8#28/9/2014# # # # # 26# # 4) The!cross!compilation!of!the!Linux!Kernel!to!support!the!Pi>DAC+! # This#section#assumes#you#understand#the#cross#compilation#build#process#and#the#transfer#of#a# generated#Linux#kernel#and#modules#to#the#Raspberry#Pi.#This#is#for#advanced#users#only.# # If#you#would#rather#update#Raspbian#directly#on#the#Pi#(see#section!2#above)#or#take#a#preE configured#image#(see#section#5)#later#in#this#document.# # The#Raspberry#Pi#Linux#source#(https://github.com/raspberrypi/linux/tree/rpiE3.14.y)#now#contains# builtEin#support#for#the#IQaudIO.com#PiEDAC+.#The#following#instructions#are#based#around# this#source.# # • Create#a#suitable#directory...# # From#your#Linux#PC,#make#suitable#build#directories:## # • gordon@BuildPC ~ $#mkdir ~/linux_iqaudio gordon@BuildPC ~ $#mkdir ~/linux_iqaudio/modules gordon@BuildPC ~ $#cd ~/linux_iqaudio Point#to#your#cross#compile#toolchain#(your#setup#may#be#different)#and#set#variables# gordon@BuildPC ~ $#export CCPREFIX=/home/gordon/tools/arm-bcm2708/gcclinaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihfOR gordon@BuildPC ~ $#export CCPREFIX=/usr/bin/arm-linux-gnueabigordon@BuildPC ~ $#KERNEL_SRC=~/linux_iqaudio/linux # • gordon@BuildPC ~ $#MODULES_TEMP=~/linux_iqaudio/modules/ Clone#the#source# gordon@BuildPC ~ $#git init # • • gordon@BuildPC ~ $#git clone https://github.com/raspberrypi/linux.git Now’s#a#good#time#for#a#tea#break#–#the#duration#will#depend#on#your#internet#connection# and#your#PC’s#performance.# # Build#the#system# gordon@BuildPC ~ $#cd ~/linux_iqaudio/linux gordon@BuildPC ~ $#make mrproper gordon@BuildPC ~ $#make ARCH=arm bcmrpi_defconfig gordon@BuildPC ~ $#ARCH=arm CROSS_COMPILE=${CCPREFIX} make menuconfig # v8#28/9/2014# # # # # # 27# After#menuconfig#is#built#it#should#auto#run#and#you#will#be#presented#with#a#range#of# menus,#to#ensure#that#the#IQaudIO.com#PiEDAC#is#enabled#follow#the#screenshots# below…# # # Scroll#down#and#select#Device#Drivers…# # # # Select#Sound#Card#Support# # v8#28/9/2014# # # # # 28# # And#then#Advanced#Linux#Sound#Architecture#(ALSA)# # Then#ALSA#for#SoC#(system#on#chip)#audio#support# # Select#“Support#for#IQaudIOEDAC”#and#then#Exit# # # # # # # # v8#28/9/2014# # 29# Keep#selecting#Exit#until#you#reach#the#following#prompt…,#select#Yes#to#save#and#exit.# # # # Now#build#the#Linux#kernel#based#on#your#selection.# # • # gordon@BuildPC ~ $#ARCH=arm CROSS_COMPILE=${CCPREFIX} make -j6 Once#complete,#check#that#the#Codec#and#IQaudIO.com#PiEDAC#drivers#have#been#build.## gordon@BuildPC ~ $ ls –l sound/soc/codecs/pcm512* -rw-rw-r-- 1 gordon gordon 17432 Apr 6 14:23 sound/soc/codecs/pcm512x.c -rw-rw-r-- 1 gordon gordon 5692 Apr 6 14:23 sound/soc/codecs/pcm512x.h -rw-rw-r-- 1 gordon gordon 14768 Apr 6 14:46 sound/soc/codecs/pcm512x.o # gordon@BuildPC ~ $ ls –l sound/soc/bcm/iqaudio* -rw-rw-r-- 1 gordon gordon 3118 Apr 6 14:23 sound/soc/bcm/iqaudio-dac.c -rw-rw-r-- 1 gordon gordon 4856 Apr 6 14:46 sound/soc/bcm/iqaudio-dac.o • # Build#the#modules#and#delete#the#unnecessary#links# gordon@BuildPC ~ $#ARCH=arm CROSS_COMPILE=${CCPREFIX} INSTALL_MOD_PATH=${MODULES_TEMP} make modules_install • Once#complete,#check#that#the#modules#have#been#build#as#expected…# gordon@BuildPC ~ $ ls -l sound/soc/codecs/snd* -rw-rw-r--rw-rw-r--rw-rw-r--rw-rw-r-- 1 1 1 1 gordon gordon gordon gordon gordon 18456 Apr 10 15:08 gordon 2911 Apr 10 15:06 gordon 4416 Apr 10 15:08 gordon 14784 Apr 10 14:46 sound/soc/codecs/snd-soc-pcm512x.ko sound/soc/codecs/snd-soc-pcm512x.mod.c sound/soc/codecs/snd-soc-pcm512x.mod.o sound/soc/codecs/snd-soc-pcm512x.o gordon@BuildPC ~ $ ls -l sound/soc/bcm/snd* -rw-rw-r--rw-rw-r--rw-rw-r--rw-rw-r--rw-rw-r--rw-rw-r--rw-rw-r--rw-rw-r-- • 1 1 1 1 1 1 1 1 gordon gordon gordon gordon gordon gordon gordon gordon gordon 11591 Apr 10 15:08 sound/soc/bcm/snd-soc-bcm2708-i2s.ko gordon 2033 Apr 10 15:06 sound/soc/bcm/snd-soc-bcm2708-i2s.mod.c gordon 3308 Apr 10 15:08 sound/soc/bcm/snd-soc-bcm2708-i2s.mod.o gordon 9029 Apr 10 14:46 sound/soc/bcm/snd-soc-bcm2708-i2s.o gordon 6532 Apr 10 15:08 sound/soc/bcm/snd-soc-iqaudio-dac.ko gordon 1208 Apr 10 15:06 sound/soc/bcm/snd-soc-iqaudio-dac.mod.c gordon 2408 Apr 10 15:08 sound/soc/bcm/snd-soc-iqaudio-dac.mod.o gordon 4870 Apr 10 14:46 sound/soc/bcm/snd-soc-iqaudio-dac.o Now#delete#the#unnecessary#symbolic#links#before#transferring#to#the#Pi…# gordon@BuildPC ~ $#rm ~/linux_iqaudio/modules/lib/modules/3.10.36+/source ## • gordon@BuildPC ~ $#rm ~/linux_iqaudio/modules/lib/modules/3.10.36+/build Make#the#kernel#image#(the#new#kernel.img#file#is#stored#in#this#mkimage#directory)# gordon@BuildPC ~ $##cd ~/tools/mkimage v8#28/9/2014# # # # # 30# # • # • gordon@BuildPC ~ $ ./imagetool-uncompressed.py ${KERNEL_SRC}/arch/arm/boot/zImage From#the#build#PC#copy#the#kernel#image#to#the#Pi's#home#directory#(here#the#Pi’s# IPAddress#is#10.0.0.13)# gordon@BuildPC ~ $#scp kernel.img [email protected]:. From#the#Pi,#copy#the#kernel#to#the#boot#directory# pi@raspberrypi ~ $#sudo cp /boot/kernel.img /boot/kernel.img.old # • # • pi@raspberrypi ~ $#sudo cp ~/kernel.img /boot/kernel.img From#the#Pi,#copy#the#modules#to#the#/boot/lib/#directory.#(Here#the#Build#PC’s#IPAddress# is#10.0.0.3)# pi@raspberrypi ~ $#sudo scp -r [email protected]:/home/gordon/linux_iqaudio/modules/lib/* /lib/. Flush#your#filesystem#changes#and#reboot#the#Raspberry#Pi# pi@raspberrypi ~ $#sync # • # pi@raspberrypi ~ $#sudo reboot You#must#enable#i2C#support#for#the#PiEDAC#to#operate.#On#the#Raspberry#Pi#check#if#you# have#the#following#file#and#if#so#delete#the#line#containing#i2cEbcm2708.# pi@raspberrypi ~ $#sudo nano /etc/modprobe.d/raspi-blacklist.conf Delete#the#line#containing#the#text#below#if#it#exists# # # • # blacklist i2c-bcm2708 To#ensure#that#the#necessary#kernel#modules#are#loaded#at#boot,#you#must#add#the# following#lines#to#/etc/modules# pi@raspberrypi ~ $#sudo nano /etc/modules snd_soc_bcm2708 snd_soc_bcm2708_i2s bcm2708_dmaengine # • snd_soc_pcm512x snd_soc_iqaudio_dac Flush#your#filesystem#changes#and#reboot#the#Raspberry#Pi# pi@raspberrypi ~ $#sync # # pi@raspberrypi ~ $#sudo reboot v8#28/9/2014# # # # # # 31# 5) Obtaining!audio!from!the!Raspberry!Pi!through!the!Pi>DAC! # Once#the#Linux#kernel#and#modules#have#been#copied#to#the#Raspberry#Pi#and#the#Linux# configuration#has#been#changed#to#include#the#loading#of#the#IQaudIO.com#PiEDAC+#at#boot# you#should#now#be#able#to#listen#to#some#music.# # • Once#the#Raspberry#Pi#boots,#log#in#and#check#that#the#IQaudIO#PiEDAC#is#visible#as#an# ALSA#audio#card#by#running#aplay#–l,#the#output#should#be#similar#to#that#below.#Note#the# device#number#and#Subdevice#number#–#these#may#be#useful#to#you#when#configuring# media#applications#to#access#the#PiEDAC#in#your#system.# # pi@raspberrypi ~ $ aplay –l **** List of PLAYBACK Hardware Devices **** card 0: sndrpiiqaudioda [snd_rpi_iqaudio_dac], device 0: IQaudIO DAC HiFi pcm512xhifi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 # • Check#that#you#can#adjust#the#volume.#From#the#Raspberry#Pi#run#alsamixer.#If#you#have# more#than#one#sound#card#installed#you#may#have#to#select#which#is#being#controlled#by# pressing#the#F6#key.# # pi@raspberrypi ~ $ alsamixer # # Now#adjust#the#volume#by#highlighting#“Playback#Digital”##(Press#your#cursor#keys#left#and# right#to#select)#and#increase#/#decrease#the#volume#by#pressing#your#up#and#down#curson# keys.##Remember#+0dB#is#full#volume,#E23.5dB#is#mute!#(Note#0db#~#85%#on#the#volume# range)# # Set#the#volume#at#around#30%#and#from#another#terminal#(or#exit#from#alsamixer#first)# Test#that#audio#can#be#heard#through#the#PiEDAC+.#Notice#the#hw#parameter#which#points# to#device#0,#sub#device#0#in#the#example#below.#Change#these#values#depending#on#the# output#of#the#aplay#–l#utility#above.# v8#28/9/2014# # # # # 32# # pi@raspberrypi ~ $ mplayer -ao alsa:device=hw=0,0 -nolirc http://stream.radioactive.fm:8000/ractive # # If#you#don’t#have#mplayer#already#installed:# # # pi@raspberrypi ~ $ sudo apt-get update # pi@raspberrypi ~ $ sudo apt-get install mplayer # If#you#are#unable#to#detect#the#PiEDAC#(using#aplay#–l)#or#alsamixer#doesn’t#show#any#IQaudIO# card#then#please#reEcheck#section#2#and#ensure#that#the#configuration#is#correct.#The#following# commands#may#help#you#during#debug:# # # pi@raspberrypi ~ $ dmesg … 6.549255] pcm512x 1-004c: No SCLK, using BCLK: -2 6.556344] sd 0:0:0:0: Attached scsi generic sg0 type 0 6.570452] pcm512x 1-004c: Completed initialisation - pcm512x_probe … [ 13.302381] snd-rpi-iqaudio-dac snd-rpi-iqaudio-dac.0: pcm512x-hifi <-> bcm2708i2s.0 mapping ok [ [ [ pi@raspberrypi ~ $ lsmod pi@volumio:~$ lsmod Module nfsd ipv6 snd_soc_iqaudio_dac bcm2708_dmaengine virt_dma snd_soc_pcm512x sg snd_soc_bcm2708_i2s regmap_mmio snd_soc_core regmap_spi snd_pcm snd_page_alloc v8#28/9/2014# # # # # Size 243497 304050 2493 5108 2273 8913 18996 5474 2806 131292 1897 81593 5156 Used by 2 36 0 1 1 bcm2708_dmaengine 1 0 2 1 snd_soc_bcm2708_i2s 3 snd_soc_pcm512x,snd_soc_iqaudio_dac,snd_soc_bcm2708_i2s 2 snd_soc_pcm512x,snd_soc_core 2 snd_soc_core,snd_soc_iqaudio_dac 1 snd_pcm 33# regmap_i2c snd_compress snd_seq snd_timer snd_seq_device leds_gpio led_class snd spi_bcm2708 i2c_bcm2708 1645 8060 53769 20133 6473 2059 3688 61291 4728 3997 2 1 0 2 1 0 1 6 0 0 snd_soc_pcm512x,snd_soc_core snd_soc_core snd_pcm,snd_seq snd_seq leds_gpio snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress # # # 6) Common!Linux!distribution!configurations! # Linux#based#audio#/#media#distributions#and#the#configuration#file#contents#are#listed#below.#If# you#have#other#information#you#would#like#to#see#added#to#this#documentation#then#please# email#[email protected]#with#the#specific#details.# # Note,#in#earlier#Linux#kernel#versions#the#Hardware#volume#mixer#is#known#as#“Playback# Digital”.#On#more#recent#versions#of#the#kernel#this#Hardware#volume#mixer#control#is#known# as#“PCM”.#Please#see#alsamixer#for#the#name#used#in#your#particular#kernel#version.# # a. Volumio!(Thanks!to!tracer5)! ! # Volumio!1.3:! Since#13/6/2014,#Volumio#1.3#includes#the#necessary#Linux#modules#to#support#the#PiEDAC#but#does# need#a#simple#change#to#the#/etc/mpd.conf#file#allowing#hardware#volume#control.# # Once#you#have#selected#the#IQaudIO#PiEDAC+#within#Volumio’s#system#settings#and#rebooted.#SSH# into#the#Pi#and#edit#/etc/mpd.conf#and#change#“PCM”#to#“Playback#Digital”#to#address#the#correct# mixer#control#of#the#IQaudIO.com#PiEDAC+.#Remember#to#save,#sync#and#reboot#for#these#changes#to# take#effect.# # # audio_output#{# # #################type###########"alsa"# #################name###########"Output"# #################device#########"hw:0,0"# #################mixer_control##"Playback#Digital"# # //#Note#in#later#kernels#this#is#“PCM”# #################mixer_device###"hw:0"# #################mixer_index####"0"# #################dsd_usb########"yes"# }# # # # # The!following!instructions!are!for!versions!of!Volumio!PRIOR!to!v1.3:! # Start#with#downloading#the#latest#beta#from#the#Volumio#site:##Raspberry#Pi#Volumio1.2beta# # Write#image#file#to#SD#card;#boot#image#on#Raspberry#Pi;#ssh#to#pi# # Update#the#kernel#and#firmware# # To!update!packages:! # sudo apt-get update && sudo apt-get upgrade v8#28/9/2014# # # # # 34# # To!update!kernel:! # sudo apt-get update && sudo apt-get -y dist-upgrade # Use!the!Hexxeh!script!to!install!the!rpi>update!tool:! # sudo apt-get install rpi-update # sudo curl -L --output /usr/bin/rpi-update https://raw.github.com/Hexxeh/rpiupdate/master/rpi-update && sudo chmod +x /usr/bin/rpi-update # To!update!the!firmware:! sudo rpi-update # Reboot!to!load!the!new!firmware.! sudo reboot # Get#the#name#and#configuration#of#the#updated#linux#kernel# uname -a # Mine#is:####3.10.36+##664#PREEMPT# # Configure!Linux!to!load!the!IQaudIO!modules! Edit:#/etc/modules#to#look#like#this…# # snd_soc_bcm2708 snd_soc_bcm2708_i2s bcm2708_dmaengine snd_soc_pcm512x snd_soc_iqaudio_dac # # Ensure!the!changes!are!committed!to!the!SD!card!and!reboot! sync sudo reboot # The#Raspberry#Pi#with#IQAudIO#PiEDAC+#should#now#be#working.# # Note1:#In#MPD#System#settings#do#not#Activate#I2S#driver#as#it#will#overwrite#the#/etc/modules#file# with#the#HiFiBerry#values.# # Note2:#If#you#would#like#volume#control#then#edit#/etc/mpd.conf#to#address#the#correct#mixer# control#of#the#IQaudIO.com#PiEDAC+#have#the#following#in#audio_output#section…# ## audio_output#{# # #################type###########"alsa"# #################name###########"Output"# #################device#########"hw:0,0"# #################mixer_control##"Playback#Digital"# # # //#Note#in#later#kernels#this#is#“PCM”# #################mixer_device###"hw:0"# #################mixer_index####"0"# #################dsd_usb########"yes"# # }# ! b. RuneAudio! Alpha#0.3#includes#support#for#the#IQaudIO.com#PiEDAC+.## # c. PiCorePlayer! IQaudIO.com#PiEDAC+#support#is#built#in.# # v8#28/9/2014# # # # # 35# 7) Adding!the!optional!PIN!headers!to!the!Pi>DAC+! # The#PiEDAC+#will#work#without#adding#any#additional#pin#headers.#The#pin#headers#supplied# are#for#those#who#may#want#to#access#the#B+’s#GPIO#and#add#things#like#rotary#encoders,#LCD# screens#or#IR#sensors.# # The#Pin#headers#supplied#with#the#PiEDAC+#should#be#added#in#the#following#way.#This#will# allow#you#to#add#a#Future#PiEAMP+#without#further#effort.# # The#Straight#pin#headers#are#designed#for#pins#1E10#of#the#40way.#These#should#be#soldered#to# the#TOP#of#the#PiEDAC+.#These#10#GPIO#will#then#be#reEexposed#on#the#PiEAMP+.# # # # The#RIGHT#ANGLED#Pin#headers#are#designed#for#pins#11E40#of#the#40way.#These#should#be# soldered#UNDERNEATH#the#PiEDAC+# # # v8#28/9/2014# # # # # 36#