Compile Wolfson Audio Card driver for kernel 3.12.y

Hi,

This howto is obsolete!

If this part

git reset –hard 4639d2b773b318d4b0409f67d3d5e73a513ba64b

does not work for you, do it the easy way and checkout the patched sources from here.

Compile and install as described here -> http://elinux.org/RPi_Kernel_Compilation

 

 

this is a quick ’n dirty howto for compiling the Wolfson Audio card drivers for the Raspberry Pi. To do that quickly we don’t compile on the Raspberry Pi but we install a cross compiling environment.

This howto is intendet for users who are (or sholud be) familiar with linux, bash, kernel compilation, full realtime preemption and cross compiling.

If your are NOT you are strongly adviced to read these sites in detail:

Read these sites CAREFULLY ->
http://elinux.org/RPi_Kernel_Compilation
http://wiki.linuxaudio.org/wiki/raspberrypi
http://www.element14.com/community/thread/31714/l/instructions-for-compiling-the-wolfson-audio-card-kernel-drivers-and-supported-use-cases

Here we go:

Read something about cross compiling and install cross compiling environment on your linuxbox
http://elinux.org/RPi_Kernel_Compilation#2._Cross_compiling_from_Linux

Download 2014-01-07-wheezy-raspbian.zip from
http://www.raspberrypi.org/downloads/

unzip and copy to sdcard as described here ->
http://www.raspberrypi.org/documentation/installation/installing-images/README.md
boot your Raspberry Pi (in this howto it’s called rpi)

On your linux box (mine has Ubuntu Studio 14.04 running) follow these steps
Let’s cross compile
Install youre cross compiler environment as described here ->
http://elinux.org/RPi_Kernel_Compilation#2._Cross_compiling_from_Linux
then follow these steps:

1.  mkdir ~/linux_rt_wlfsn
2.  cd ~/linux_rt_wlfsn
3.  git init
4.  git clone –depth 1 git://github.com/raspberrypi/linux.git
5.  cd linux
6.  git checkout rpi-3.12.y
7.  git reset –hard 4639d2b773b318d4b0409f67d3d5e73a513ba64b
8.  cd ..
9.  mkdir -P patches/wolfson_drivers
10. cd patches
11. wget -c https://www.kernel.org/pub/linux/kernel/projects/rt/3.12/patch-3.12.15-rt25.patch.xz
12. Read http://www.element14.com/community/thread/31714/l/instructions-for-compiling-the-wolfson-audio-card-kernel-drivers-and-supported-use-cases
13. wget -c http://downloads.element14.com/wolfson/wolfson_drivers.tar.gz?COM=WolfsonAudioCard -O wolfson_drivers.tar.gz
14. unxz patch-3.12.15-rt25.patch.xz
15. cd wolfson_drivers
16. tar -zxvf wolfson_drivers.tar.gz
17. cd ~/linux_rt_wlfsn
18. mkdir raspi_rt_image
19. export ARCH=arm
20. export CROSS_COMPILE=/data/download/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-
21. export INSTALL_MOD_PATH=~/linux_rt_wlfsn/raspi_rt_image
22. cd linux
23. //clean the kernel sources
24. git clean -xfd
25. git reset –hard
26. git checkout -f
27. git pull –rebase
28. git reset –hard 4639d2b773b318d4b0409f67d3d5e73a513ba64b
//This should show something like ->
//HEAD ist jetzt bei 4639d2b ASoC: wm8804: Set idle_bias_off to false Idle bias has been change to remove warning on driver startup
29. git checkout rpi-3.12.y
30. git status
//should show something like this:
//# On branch rpi-3.12.y
//# Your branch is behind ‚origin/rpi-3.12.y‘ by 198 commits, and can be fast-forwarded.
//#
//nothing to commit (working directory clean)
31. make -j4  ARCH=arm CROSS_COMPILE=${CROSS_COMPILE} mrproper

32. Download the Wolfson Audio Card patches for the 3.12.y kernel

a.) including full realtime preemption patch, sdhci patch to get the sdhci card running with rt and bogoMips patch to get jackd running without error

here : 0001-RT_3.12.13-rt21-BogoMips-SDHCI-for-rpi.patch_.xz and do a

git apply –check ../patches/0001-RT_3.12.13-rt21-BogoMips-SDHCI-for-rpi.patch

if there is no error message apply again without checking ->

git apply ../patches/0001-RT_3.12.13-rt21-BogoMips-SDHCI-for-rpi.patch

The original patch is developed by Ingo Molnar and other kernel developers and can be downloaded here ->

https://www.kernel.org/pub/linux/kernel/projects/rt/

More info about full  realtime preemption can be found here ->

https://rt.wiki.kernel.org/index.php/Main_Page

b.) only the Wolfson Audio Card patches for the 3.12.y kernel

here: rpi_wlf_3.12_beta.tar.xz

git apply –check ../patches/rpi_wlf_3.12_beta/*.patch

if there is no error message apply again without checking ->

git apply  ../patches/rpi_wlf_3.12_beta/*.patch

33. Download working config file and save it   in „patches“ folder

cp ../patches/config.txt .config

34. make -j4  ARCH=arm CROSS_COMPILE=${CROSS_COMPILE} olddefconfig

35.  //for those with e.g. 4 cpu’s
make -j4  ARCH=arm CROSS_COMPILE=${CROSS_COMPILE}
//otherwise (1 cpu only)
make ARCH=arm CROSS_COMPILE=${CROSS_COMPILE}

36. make -j4 ARCH=arm CROSS_COMPILE=${CROSS_COMPILE} modules
37. make -j4 ARCH=arm CROSS_COMPILE=${CROSS_COMPILE} INSTALL_MOD_PATH=${INSTALL_MOD_PATH} modules_install

38. mkdir -p ~/linux_rt_wlfsn/raspi_rt_image/boot
39. cp arch/arm/boot/Image ~/linux_rt_wlfsn/raspi_rt_image/boot/kernel_3.12.15-rt25.img
// let’s get the right firmware for the new kernel
// http://elinux.org/RPi_Kernel_Compilation#Get_the_firmware
40. cd ~/linux_rt_wlfsn
41. git clone -b next –depth 5 https://github.com/raspberrypi/firmware.git
42. cd firmware/boot
43. rm start_cd.elf start.elf kernel_emergency.img kernel.img fixup_cd.dat fixup.dat LICENCE.broadcom COPYING.linux
44. mv start_x.elf start.elf
45. mv fixup_x.dat fixup.dat
46. cd ..
47. rm -rf documentation extra README opt modules
48. mv hardfp/opt opt
49. rm -rf opt/vc/src hardfp
50. cp -R * ~/linux_rt_wlfsn/raspi_rt_image
51. cd ~/linux_rt_wlfsn/raspi_rt_image

//for Wolfson Drivers only
52 a) rm -f -r lib/modules/3.12.13+/build
52 a) rm -f -r lib/modules/3.12.13+/source

// for Wolfson Drivers on rt incl. all patches

52 b) rm -f -r lib/modules/3.12.13-rt21+/build
52 b) rm -f -r lib/modules/3.12.13-rt21+/source

If everything is fine you are ready to copy the new kernel and firmware on your rraspberry pi.

You can use scp to do this. Boot your Pi and on your linux box run this:

53. scp  -r ~/linux_rt_wlfsn/raspi_rt_image/* pi@ip-of-your-pi:.  (the dot at the end of the line is important! Do not miss).

login to your pi via ssh

ssh -X pi@ip-of-your-pi

on rpi you should copy the whole content of the ~/boot ~lib and ~opt directories to your root directory /

cp -rf boot/* /boot

cp -rf lib/* /lib

cp -rf opt/* /opt

sudo reboot

ssh into your pi after reboot and do a

uname -a

which should give you
Linux raspberrypi 3.12.13-rt21+ #1 PREEMPT RT Thu Mar 27 16:58:09 CET 2014 armv6l GNU/Linux

If you got this feel happy and

Have fun.

This howto was possible because of this excellent site which describes how to use the raspberry pi with full realtime preemption and jackd ->

http://linux.autostatic.com/2013/10/20/using-a-raspberry-pi-as-a-piano

Thanks a lot to autostatic!

E-Drumset selbst gebaut

Here you can find the code for an Arduino midi drumkit with 52 analog inputs.
The project is hosted on SourceForge now and you can download a new version (1.2)  which is compatible to Arduino IDE 1.0  here:
http://sourceforge.net/projects/yaamidrum/

Real Life Demo of the YAAMIDRUM:
The sound quality of this video is really bad for some reasons:
1. I use free sample drumsounds.
2. The mic of my video cam produces very poor quality.
3. The speakers output of my laptop does this either.

It’s not so interesting for me. This video shows that it is possible to build a low latency e-drum set with hardware that isn’t designed for doing such things like playing drums. Arduino is originally build for other purposes.
In this example I use a simple Midi-to-USB converter cable at a baudrate of 31250. You could even use the USB cable that is used to power on the arduino, because it sends the MIDI data as a serial device to your computer. This can be achieved by changing the baudrate from 31250 to 115200 in the YAAMIDRUM sketch and using a serial to mid converter software like ttymidi. In that case you can’t use the MIDI In and Out of the Arduino, because 31250 is the standard baudrate for midi instruments. If you don’t use any other midi instruments together with your arduino on the Midi In port, you should use the second solution (ttymidi). For Win and Mac users there exists other software to achieve the same.

Midi module
Hihat sensor

What you need:
– 1 Arduino (UNO)
– 1 Mux Shield or in Germany -> e.g. here

– Materials for Midi in and out, see here -> http://www.thebox.myzen.co.uk/Hardware/MIDI_Shield.html
– 1 Infrared distance sensor Pololu QTR-1A -> http://www.pololu.com/catalog/product/958 or in Germany (QTR-1A-Abstandssensor)
– up to 48 Piezos (http://www.conrad.de/ce/de/product/710995/PIEZOKERAMISCHER-SCHALLWANDLER-FT-36T/0235311&ref=list)
– for each piezo you need one 5,1 V zener diode
and one 1Mega Ohm resistor.
– 24 Stereo jacks
– a lot of wires
– 1 soldering iron
– a box to put all things together, I took something like this, but pay attention!!! First eat the content, than put the electronic into it 😉

Some schematics:

The midi in and out I used for this project is perfectly explained here -> http://www.thebox.myzen.co.uk/Hardware/MIDI_Shield.html

The piezos should be connected like shown in this schematic. It can be found here. Of course you should connect the piezos with the 48 inputs of the Mux Shield on top of the arduino.

Please take a look at the Arduino sketch to find out more about how to connect everything.

Arduino in a plastic box
Arduino in a plastic box
4 stereo cymbals with choke -front-
4 stereo cymbals with choke -front-
4 stereo cymbals with choke -back-
4 stereo cymbals with choke -back-
Hihat with infrared sensor
Hihat with infrared sensor
Hihat with infrared sensor -detail-
Hihat with infrared sensor -detail-
Connections: Midi IN and OUT, USB, Power supply
Connections: Midi IN and OUT, USB, Power supply
Connections: top row -stereo jacks, bottom row mono jacks
Connections: top row -stereo jacks, bottom row mono jacks
Bass Drum Pedal - 'inner' view
Bass Drum Pedal – ‚inner‘ view
Bass Drum Pedal
Bass Drum Pedal
Breadboard testing phase
Breadboard testing phase
The whole drumset
The whole drumset

Have fun!