easyMav: MAVlink made Easy

RPi Install Instructions

Install Raspbian

● Raspberry Pi Imager
https://www.raspberrypi.org/downloads/
● connect keyboard, mouse, screen and follow instructions
● Desktop->Preferences->Raspberry Pi Configuration
– System-> Splash Screen: disable
– Interfaces-> SSH: enable, VNC: enable, Serial Port: enable, Serial Console: disable
– Localization-> Keyboard: Layout German
● update
https://www.raspberrypi.org/documentation/raspbian/updating.md

sudo apt update
sudo apt full-upgrade

● personal (not needed)
– Desktop->Preferences->Appearance Settings
Menu Bar: size 24×24
System: font 8
– FileManager Settings: Preferences
Display: 32×32, 16×16, 256×256, 16×16
● get IP address

hostname -I

● shutdown
● write image rpi-image-fresh-2020xxyy.img
Win32DiskManager

Uart

● Desktop->Preferences->Raspberry Pi Configuration
– Interfaces-> Serial Port: enable, Serial Console: disable
● Disable bluetooth device and restore ttyAMA0 to GPIOs 14 and 15:

sudo nano /boot/config.txt

add

dtoverlay=disable-bt

● Disable system service that initialises modem so it doesn’t use the UART:

sudo systemctl disable hciuart
reboot

● Tests:

ls -la /dev/ttyAMA0

should yield crw-rw—- 1 root dialout 204, 64 Mar 17 12:00 /dev/ttyAMA0

ls -la /dev/serial0

should yield lrwxrwxrwx 1 root root 7 Mar 17 12:00 /dev/serial0 -> ttyAMA0
(it must not yield ttyS0)
● shutdown
● write image rpi-image-default-2020xxyy.img
Win32DiskManager

Access Point

● follow instructions up to „Add routing and masquerade“, which are (slightly reordered):
https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md
– sudo apt install dnsmasq
– sudo apt install hostapd
– sudo systemctl stop dnsmasq
– sudo systemctl stop hostapd
– sudo nano /etc/dhcpcd.conf
add:
interface wlan0
static ip_address=192.168.4.1/24
nohook wpa_supplicant
– sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
– sudo nano /etc/dnsmasq.conf
type in:
interface=wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
– sudo nano /etc/hostapd/hostapd.conf
add:
interface=wlan0
driver=nl80211
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ssid=APNAME !!!choose
wpa_passphrase=PASSWORD !!!choose (must be at least 6 characters)
– sudo nano /etc/default/hostapd
replace:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
– sudo systemctl start dnsmasq
– sudo systemctl unmask hostapd
– sudo systemctl enable hostapd
● connect keyboard, mouse, screen and finish instructions (VNC connection will be lost):
– sudo systemctl start hostapd
– sudo service dhcpcd restart
● Tests:
– reboot
– sudo systemctl status hostapd
– sudo systemctl status dnsmasq
– VNC connect to APNAME, 192.168.4.1 (may take a while)
● disable AP as default
– sudo systemctl disable dnsmasq
– sudo systemctl disable hostapd
– sudo nano /etc/dhcpcd.conf file
comment out lines added at the bottom of the file:
#interface wlan0
#static ip_address=192.168.4.1/24
#nohook wpa_supplicant
● shutdown
● write image rpi-image-defaultwap-2020xxyy.img
Win32DiskManager

● reenable AP:
– sudo nano /etc/dhcpcd.conf file
un-comment lines added at the bottom of the file:
– sudo systemctl start dnsmasq
– sudo systemctl enable hostapd
– sudo systemctl start hostapd
– sudo service dhcpcd restart

Install MAVLink Dependencies

It can’t hurt to do:

sudo apt update
sudo apt upgrade

Install mavlink-router

● install dependencies (may or may not be already present)(order is irrelevant)

sudo apt install python-future
sudo apt install python3-future
sudo apt install libtool
sudo apt install autoconf

● get mavlink-router files

cd into a folder where the git repo should be located (e.g. Documents/Github/)
git clone https://github.com/intel/mavlink-router.git
cd mavlink-router
git submodule update ‐‐init ‐‐recursive

● build&install (type, not copy)

./autogen.sh
./configure CFLAGS='-g -O2' --sysconfdir=/etc --localstatedir=/var 
--libdir=/usr/lib --prefix=/usr
make
sudo make install

comment: I would think that for a RPi4 one should use –libdir=/usr/lib64 instead of –libdir=/usr/lib in the configure command. ??

● Tests:

mavlink-routerd -c /home/pi/Documents/mavlink-router/my.config
mavlink-routerd -d /home/pi/Documents/mavlink-router/

with my.config:

[General]
   #MavlinkDialect=common
   MavlinkDialext=ardupilotmega
   Log=/home/pi/Documents/mavlink-router/logs
[UartEndpoint first]
   Device=/dev/serial0
   Baud=57600
   FlowControl=false
[UartEndpoint second]
   Device=/dev/ttyUSB0
   Baud=57600
   FlowControl=false

– open new console
– cd to /mavlink-router/examples (mavlink-routerd must of course be running in the other console)

python3 heartbeat-print-tcp.py 0.0.0.0:5760

Install Dual Uart SC16IS752

● install sc16is752-spi0-ce0-ow.dtbo
– copy file sc16is752-spi0-ce0-ow.dtbo to RPi

sudo cp sc16is752-spi0-ce0-ow.dtbo /boot/overlays/

– sudo nano /boot/config.txt
add:

dtoverlay=sc16is752-spi0-ce0-ow,int_pin=17

– reboot
Comment: if the dts file needs to be compiled, do

dtc -@ -I dts –O dtb –o sc16is752-spi0-ce0-ow.dtbo sc16is752-spi0-ce0-ow.dts

● Tests:

sudo vcdbg log msg

should yield:
:
002005.567: brfs: File read: 1958 bytes
002013.808: brfs: File read: /mfs/sd/overlays/disable-bt.dtbo
002049.208: Loaded overlay ‚disable-bt‘
002122.524: brfs: File read: 954 bytes
002125.616: brfs: File read: /mfs/sd/overlays/sc16is752-spi0-ce0-ow.dtbo
002152.286: Loaded overlay ’sc16is752-spi0-ce0-ow‘
002152.341: dtparam: int_pin=17
002256.770: brfs: File read: 1851 bytes
002259.368: brfs: File read: /mfs/sd/cmdline.txt
002259.447: Read command line from file ‚cmdline.txt‘:
002259.502: ‚console=tty1 root=PARTUUID=ea7d04d6-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait‘
004225.843: gpioman: gpioman_get_pin_num: pin EMMC_ENABLE not defined
:

lsmod

should yield:
:
sc16is7xx 20480 0
:

ls -la /dev/tty*

should yield:
:
crw-rw—- 1 root dialout 204, 64 Apr 10 19:17 /dev/ttyAMA0
crw——- 1 root root 5, 3 Apr 10 19:17 /dev/ttyprintk
crw-rw—- 1 root dialout 4, 64 Apr 10 19:17 /dev/ttyS0
crw-rw—- 1 root dialout 240, 0 Apr 10 19:17 /dev/ttySC0
crw-rw—- 1 root dialout 240, 1 Apr 10 19:17 /dev/ttySC1

Hinterlasse einen Kommentar