From 57da61dc17e355d00f1a960028a074974be9fdb5 Mon Sep 17 00:00:00 2001 From: blazczak Date: Sat, 3 Oct 2020 07:51:27 -0700 Subject: [PATCH] posix-configs/rpi: Fix mavlink over UART (/dev/ttyAMA0) UART is the primary interface for telemetry radio: https://docs.emlid.com/navio2/ardupilot/hardware-setup/#uart-radio Check first if /dev/ttyUSB0 exists (https://docs.emlid.com/navio2/ardupilot/hardware-setup/#usb-radio); if not, fall back to configuring over UART (/dev/ttyAMA0). Use stricter check for character special file (-c) rather than just file (-f). 'console=serial0,115200' needs to be removed from /cmdline.txt as additional configuration step. This should be documented in the Navio2 section of docs.px4.io. Presumably, this is already performed as part of the Raspberry Pi OS prebuilt image Emlid spins. --- posix-configs/rpi/px4.config | 5 ++++- posix-configs/rpi/px4_fw.config | 5 ++++- posix-configs/rpi/px4_test.config | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/posix-configs/rpi/px4.config b/posix-configs/rpi/px4.config index 1fce866cae..eb982afeca 100644 --- a/posix-configs/rpi/px4.config +++ b/posix-configs/rpi/px4.config @@ -45,9 +45,12 @@ mc_rate_control start mavlink start -x -u 14556 -r 1000000 -if [ -f /dev/ttyUSB0 ] +if [ -c /dev/ttyUSB0 ] then mavlink start -x -d /dev/ttyUSB0 +elif [ -c /dev/ttyAMA0 ] +then + mavlink start -x -d /dev/ttyAMA0 fi navio_sysfs_rc_in start diff --git a/posix-configs/rpi/px4_fw.config b/posix-configs/rpi/px4_fw.config index 1b76850746..6952c3d802 100644 --- a/posix-configs/rpi/px4_fw.config +++ b/posix-configs/rpi/px4_fw.config @@ -44,9 +44,12 @@ fw_pos_control_l1 start mavlink start -x -u 14556 -r 1000000 -if [ -f /dev/ttyUSB0 ] +if [ -c /dev/ttyUSB0 ] then mavlink start -x -d /dev/ttyUSB0 +elif [ -c /dev/ttyAMA0 ] +then + mavlink start -x -d /dev/ttyAMA0 fi navio_sysfs_rc_in start diff --git a/posix-configs/rpi/px4_test.config b/posix-configs/rpi/px4_test.config index 4790ffa06d..354338e85f 100644 --- a/posix-configs/rpi/px4_test.config +++ b/posix-configs/rpi/px4_test.config @@ -44,9 +44,12 @@ mc_att_control start mavlink start -x -u 14556 -r 1000000 -if [ -f /dev/ttyUSB0 ] +if [ -c /dev/ttyUSB0 ] then mavlink start -x -d /dev/ttyUSB0 +elif [ -c /dev/ttyAMA0 ] +then + mavlink start -x -d /dev/ttyAMA0 fi navio_sysfs_rc_in start