diff --git a/RPi_FW/README.md b/RPi_FW/README.md index b188a0748d8be25e8d6644459b99fe0723446ca7..7aecb08745fc12bed293ebe49f81364711e40bcb 100644 --- a/RPi_FW/README.md +++ b/RPi_FW/README.md @@ -1,56 +1,74 @@ # Wiring -RPi -19: MOSI -21: MISO -23: SCLK -24: CE0 (GPIO 10) - -STM32: -PA5: CLK -PA6: MISO -PA7: MOSI -PE0: CS(NSS) +## RPi +* 19: MOSI +* 21: MISO +* 23: SCLK +* 24: CE0 (GPIO 10) + +## STM32 +* PA5: CLK +* PA6: MISO +* PA7: MOSI +* PE0: CS(NSS) # Setup RPi as Access Point +```shell sudo apt-get update sudo apt-get dist-upgrade sudo apt-get install dnsmasq # A lightweight DHCP and caching DNS server sudo apt-get install hostapd # Host access point daemon (for turning normal network interface cards into access points) +``` ## Stop servers for now +```shell sudo systemctl stop dnsmasq sudo systemctl stop hostapd +``` -## configure static IP +## Configure static IP +```shell sudo vi /etc/dhcpcd.conf -""" +``` + +``` denyinterfaces wlan0 -""" +``` +```shell sudo vi /etc/network/interfaces -""" -allow-hotplug wlan0 -iface wlan0 inet static +``` + +``` +allow-hotplug wlan0 +iface wlan0 inet static address 192.168.0.1 netmask 255.255.255.0 network 192.168.0.0 -""" +``` +```shell sudo service dhcpcd restart sudo ifdown wlan0 sudo ifup wlan0 +``` -## configure DHCP server -sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig +## Configure DHCP server +```shell +sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig sudo vi /etc/dnsmasq.conf -""" +``` + +``` interface=wlan0 # Use the require wireless interface - usually wlan0 dhcp-range=192.168.0.2,192.168.0.20,255.255.255.0,24h # 18 IP addresses should be enough, lease time 24h -""" +``` ## configure access point host software (hostapd) +```shell sudo vi /etc/hostapd/hostapd.conf -""" +``` + +``` interface=wlan0 driver=nl80211 ssid=BATS0 @@ -65,19 +83,29 @@ wpa_passphrase=batsberlin2017 wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP -""" +``` +```shell sudo vi /etc/default/hostapd -""" +``` + +``` DAEMON_CONF="/etc/hostapd/hostapd.conf" -""" +``` -sudo service hostapd start +```shell +sudo service hostapd start sudo service dnsmasq start +``` -# Run spi_master.elf on start-up +## Run spi_master.elf on start-up +```shell sudo vim /etc/init.d/start_spi_master.sh -""" +``` + +Add the following content: + +```shell #! /bin/sh ### BEGIN INIT INFO # Provides: spi_master @@ -88,7 +116,7 @@ sudo vim /etc/init.d/start_spi_master.sh # Short-Description: Start spi_master at boot time # Description: Enable service provided by daemon. ### END INIT INFO - + case "$1" in start) echo "spi_master will be started" @@ -103,10 +131,12 @@ case "$1" in exit 1 ;; esac - + exit 0 -""" +``` +```shell sudo chmod 755 /etc/init.d/start_spi_master.sh sudo update-rc.d start_spi_master.sh defaults +```