Skip to content

Commit

Permalink
posix-configs/rpi: Fix mavlink over UART (/dev/ttyAMA0)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blazczak authored Oct 3, 2020
1 parent 91fa200 commit 57da61d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion posix-configs/rpi/px4.config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion posix-configs/rpi/px4_fw.config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion posix-configs/rpi/px4_test.config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 57da61d

Please sign in to comment.