You should test the serial portt with a terminal app like minicom, and connect to PC using usb to serial adaptor to make sure the communication works and the port is correctly assigned
It works under UBUNTU but it is a pain to set the serial port, I dont have a UBUNTU load handy but googling a bit shows different method and the most important for you is going to basic == a simple test with minicom as loop back or with a PC.
Ok, I tryied:
NO LOOP: Without the loop minicom shows nothing, not even what I type in, so echo is disabled.
ttyS0: With the loop I get random characters over time, but even the one I type in.
ttyAMA0: Nothing, not even the ones I type in.
Which one I’m going to use and what’s the expected behaviour?
My problem is that the guide talk about serial0, but I can’t understand how to set it up without raspi-config, because I already tryied installing raspi-config on Ubuntu, and it seem to work, but after the procedure, I didn’t have a serial0 port under /dev.
BTW if I connect the cables from pixhawk I get random characters too.
Ahh, Ubuntu is a bit different. Raspi-config isn’t used in Ubuntu.
I think /dev/ttyAMA0 may be the correct port and is enabled as a serial console by default. You may need to disable the console via sudo perl -pe 's/console=serial0,115200//' -i /boot/firmware/cmdline.txt and rebooting.
Then try using /dev/ttyAMA0 to connect to the Pixhawk.
I can’t, cmdline.txt doesn’t exists, nor even serial0.
config.txt:
# Please DO NOT modify this file; if you need to modify the boot config, the
# "usercfg.txt" file is the place to include user changes. Please refer to
# the README file for a description of the various configuration files on
# the boot partition.
# The unusual ordering below is deliberate; older firmwares (in particular the
# version initially shipped with bionic) don't understand the conditional
# [sections] below and simply ignore them. The Pi4 doesn't boot at all with
# firmwares this old so it's safe to place at the top. Of the Pi2 and Pi3, the
# Pi3 uboot happens to work happily on the Pi2, so it needs to go at the bottom
# to support old firmwares.
[pi4]
kernel=uboot_rpi_4.bin
max_framebuffers=2
[pi2]
kernel=uboot_rpi_2.bin
[pi3]
kernel=uboot_rpi_3.bin
[all]
arm_64bit=1
device_tree_address=0x03000000
# The following settings are "defaults" expected to be overridden by the
# included configuration. The only reason they are included is, again, to
# support old firmwares which don't understand the "include" command.
enable_uart=1
cmdline=nobtcmd.txt
include syscfg.txt
include usercfg.txt
# This file is intended to contain system-made configuration changes. User
# configuration changes should be placed in "usercfg.txt". Please refer to the
# README file for a description of the various configuration files on the boot
# partition.
#dtparam=i2c_arm=off
dtparam=i2c_arm=on
dtparam=spi=on
include nobtcfg.txt
usercfg.txt:
# Place "config.txt" changes (dtparam, dtoverlay, disable_overscan, etc.) in
# this file. Please refer to the README file for a description of the various
# configuration files on the boot partition.
# Power switch
#dtoverlay=gpio-shutdown
#dtoverlay=gpio-poweroff
nobtcfg.txt:
# This configuration file sets the system up to support the serial console on
# GPIOs 14 & 15. This is the default for Ubuntu on the Pi, but disables the use
# of the Bluetooth module.
#
# If you wish to disable the serial console and use Bluetooth instead, install
# the "pi-bluetooth" package then edit "syscfg.txt" to include "btcfg.txt"
# instead of "nobtcfg.txt"
enable_uart=1
cmdline=nobtcmd.txt
#dtoverlay=pi3-disable-bt