Skip to content

1. Norns 2.0 Full Build on RasPi

Steven Noreyko edited this page Apr 9, 2019 · 24 revisions

NEW INSTRUCTIONS IN PROGRESS - DON'T USE THIS RIGHT NOW

Download raspbian stretch lite

https://www.raspberrypi.org/downloads/raspbian/ (tested with 2018-11-13 release)

write to sdcard

Use balenaEtcher - https://www.balena.io/etcher/

add ssh and wpa-supplicant files to boot partition of sd card

Some details here https://caffinc.github.io/2016/12/raspberry-pi-3-headless/

PI Setup

Boot the pi and login with default user:pass - pi:raspberry

norns setup for reference

https://github.com/monome/norns-image/blob/master/build-dev-image.md

run raspi-config

(Localization - select your own region for this )

sudo raspi-config

	Change password: sleep
	Network > Hostname (norns)
	Network > Wifi (set SSID/password)
	Interfacing > SSH (on)
	Interfacing > i2c (on)
	Interfacing > SPI (on)
	Advanced > Expand File System
	Localization > (en-US-UTF8, US-UTF8)

Finish, Reboot (you will have user pi, password sleep at this point)

check IP address

ifconfig

user setup - we

sudo passwd root

logout, login as root (easiest to with keyboard directly connected)

usermod -l we -d /home/we -m pi
groupmod --new-name we pi

exit, login as we (can jump back to SSH here)
sudo passwd -l root

disable need for passwd with sudo
sudo nano /etc/sudoers.d/010... (use 'tab' autocomplete for this - it will vary)

change pi to we

Run updates

Install git, build dependencies, etc

sudo apt-get update 

sudo apt-get dist-upgrade

sudo apt-get install vim git bc i2c-tools 
sudo apt-get -y install libncurses5-dev 

sudo wget https://monome.nyc3.digitaloceanspaces.com/dt-blob.bin 
sudo mv dt-blob.bin /boot/

update kernel with oled display module/driver

get linux sources

git clone --depth=1 https://github.com/monome/linux

then get the raspberry pi linux kernel headers

sudo apt-get install raspberrypi-kernel-headers

apt-cache policy raspberrypi-kernel raspberrypi-kernel-headers will tell you the version of your kernel and the headers installed.

COMPILE JUST THE DISPLAY MODULE

cd ~/linux

Preparing the kernel module compilation

check with linux kernel you have with (adjust version# path below if needed)
uname -r

check header versions and that kernel modules match your kernel

ls /usr/src/linux-headers*
ls /lib/modules/`  

cp /usr/src/linux-headers-$(uname -r)/Module.symvers .
cp /usr/src/linux-headers-$(uname -r)/.config .

### or hard code the path if your headers are different

cp /usr/src/linux-headers-4.14.98-v7+/Module.symvers .
cp /usr/src/linux-headers-4.14.98-v7+/.config .

## then prep for compiling the display driver

make modules_prepare

select "m" for ssd1322

If this asks you to install some extra packages, you can use menuconfig instead

make menuconfig

        Device Drivers  
         ---> Staging Drivers 
             ---> Support for small TFT LCD display modules  
                 --->
                      <M>   SSD1322 driver

Save, Exit

Always run 'make prepare' after changing the kernel config

make prepare

compile / make

make -C ~/linux SUBDIRS=drivers/staging/fbtft modules

move the drivers

sudo cp -v ~/linux/drivers/staging/fbtft/*.ko /lib/modules/$(uname -r)/kernel/drivers/staging/fbtft/
sudo depmod -a
sudo reboot

package installs

follow instructions for apt-get, accept all defaults
updated to use https://package.monome.org/

curl https://keybase.io/artfwo/pgp_keys.asc | sudo apt-key add -
echo "deb https://package.monome.org/ stretch main" | sudo tee /etc/apt/sources.list.d/norns.list

sudo apt update
sudo apt install --no-install-recommends jackd2
sudo apt-get install libboost1.62-dev
sudo apt-get install libjack-jackd2-dev
sudo apt install libmonome-dev libnanomsg-dev supercollider-language supercollider-server supercollider-supernova supercollider-dev liblua5.3-dev libudev-dev libevdev-dev liblo-dev libcairo2-dev liblua5.3-dev libavahi-compat-libdnssd-dev libasound2-dev 
sudo apt install dnsmasq
sudo apt install sc3-plugins ladspalist
sudo apt install usbmount
sudo apt install network-manager

for DAC Audio

sudo apt-get install alsa-utils
sudo apt-get install libi2c-dev

sudo nano /lib/systemd/system/systemd-udevd.service
change slave to shared, as instructed

DAC Audio Config for FATES WM8731 DAC

Skip this if you're using a different DAC chip or USB audio

modify boot/config.txt for DAC

sudo nano /boot/config.txt

dtparam=i2c_arm=on
dtparam=spi=on
dtparam=i2s=on
dtoverlay=i2s-mmap
dtoverlay=rpi-proto

dtparam=audio=off 

blacklist onboard audio

edit raspi-blacklist.conf

sudo nano /etc/modprobe.d/raspi-blacklist.conf
add blacklist snd_bcm2835

create asound.conf sudo nano /etc/asound.conf

add

pcm.!default  {
  type hw card 0
}
ctl.!default {
  type hw card 0
}

edit alsa.conf sudo nano /usr/share/alsa/alsa.conf

comment out the following lines

	#pcm.front cards.pcm.front
	#pcm.rear cards.pcm.rear
	#pcm.center_lfe cards.pcm.center_lfe
	#pcm.side cards.pcm.side
	#pcm.surround21 cards.pcm.surround21
	#pcm.surround40 cards.pcm.surround40
	#pcm.surround41 cards.pcm.surround41
	#pcm.surround50 cards.pcm.surround50
	#pcm.surround51 cards.pcm.surround51
	#pcm.surround71 cards.pcm.surround71
	#pcm.iec958 cards.pcm.iec958
	#pcm.hdmi cards.pcm.hdmi
	#pcm.modem cards.pcm.modem
	#pcm.phoneline cards.pcm.phoneline

sudo /etc/init.d/alsa-utils restart

check your device name aplay -l

check mixer ids amixer controls

set mixer values (or you can do this with alsamixer)

amixer cset numid=13 on #Output Mixer HiFi Playback Switch
amixer cset numid=4 on #Line Capture Switch
amixer cset numid=8 on #ADC High Pass Filter Switch
amixer cset numid=10 on #Playback Deemphasis Switch
amixer cset numid=3 0% # Capture Volume

sudo alsactl store

test audio speaker-test -t sine -f 440 -c 2 -D sysdefault:sndrpiproto

restart alsa
alsactl init

or you can reboot your soundcard directly
sudo /etc/init.d/alsa-utils restart

Test jackd

use hw:(card name here) or hw:(card-number) below
and test if jackd is working

export JACK_NO_AUDIO_RESERVATION=1
jackd -R -P 95 -d alsa -d hw:0 -r 48000 -n 3 -p 128 -S -s

reference from jack.init /usr/bin/jackd -R -P 95 -d alsa -d hw:0 -r 48000 -n 3 -p 128 -S -s

USB Audio Config

Use this section for USB audio devices - skip if you have a different DAC

blacklist onboard audio as above

Comment out options snd-usb-audio so it can load first sudo nano /lib/modprobe.d/aliases.conf

	options snd-usb-audio index=-2

check your device name with audio device plugged in aplay -l

NORNS SETUP

setup norns image

git clone https://github.com/monome/norns-image.git 
cd norns-image
git checkout dev // PRE 2.0

do not run setup.sh YET

norns setup config

nano setup.sh

	# comment out network interfaces copy so it does not kill your wifi 
	# if you don't do this, you may not be able to login to the pi 
	# as network manager wont bring the wifi up automatically
	
	#sudo cp config/interfaces /etc/network/interfaces

sudo nano /etc/network/interfaces

	# add this so network manager won't touch wlan0 (just in case)
	auto wlan0

nano config/norns-init.service

	# comment out these lines for analog gain stage (put # in front, we dont want any i2cset)
	#ExecStart=-/usr/sbin/i2cset -y 1 0x28 0x00
	#ExecStart=-/usr/sbin/i2cset -y 1 0x28 0x40

	# may need to comment out Mixer line ??

	#ADD after description
	After=raspi-config.service

nano config/norns-jack.service

	/usr/bin/jackd -R -P 95 -d alsa -d hw:0 -r 48000 -n 3 -p 128 -S -s
	# if your using a usb soundcard - change this. you might need to change buffer size (-p) ?

nano scripts/init-norns.sh

	# comment out i2cset for analog gain stages again
	#sudo i2cset -y 1 0x28 0x00
	#sudo i2cset -y 1 0x28 0x40
	
	# may need to comment out Mixer line depending on your DAC setup

now run setup.sh
./setup.sh

install norns

cd ~
git clone https://github.com/monome/norns.git
cd norns
git checkout dev  // PRE 2.0

./waf configure
./waf

run sclang

sclang

install sc

cd sc
./install.sh

Dust and Maiden

Copy dust from updater

Get maiden from github releases:

https://github.com/monome/maiden/releases

wget https://github.com/monome/maiden/releases/download/v0.12/maiden-v0.12.tgz
tar -xvf maiden-v0.12.tgz
rm maiden-v0.12.tgz

Overlays

compile dts files for overlays
.dts needs to be compiled to .dtbo and then the .dtbo and copy to /boot/overlays/

norns-buttons-encoders-overlay

sudo dtc -W no-unit_address_vs_reg -@ -I dts -O dtb -o /boot/overlays/norns-buttons-encoders.dtbo norns-buttons-encoders-overlay.dts

ssd1322

sudo dtc -W no-unit_address_vs_reg -@ -I dts -O dtb -o /boot/overlays/ssd1322-fates.dtbo ssd1322-fates-overlay.dts

Add overlay to /boot/config.txt so it loads the button/encoder overlay:
sudo nano /boot/config.txt

	# Buttons and encoders
	dtoverlay=norns-buttons-encoders
	dtoverlay=ssd1322-fates

Maiden Test

test: `./maiden.arm -debug -app app/build/ -data ~/norns/lua'

check functionality from browser http://norns.local/maiden/

Network / Wifi

DO THIS AFTER YOU'RE SCREEN IS UP AND RUNNING PROPERLY

remove wlan0 reference from /etc/network/interfaces
rename /etc/wpa_supplicant/wpa_supplicant.conf to something else and reboot.
this should get network manager to take over