19.2.12. UART Configuration
Attention
By default UART0 is used as a login terminal. Do not change this, unless there is a compelling reason to do so.
We have made the decision to use UART5 for the telemetry communication with the FCU. UART4 is connected to the debug port of the FCU.
UART-KERNELS-Pin Mapping
The UART functions in the following table depend on whether Raspberry Pi is used in a UUV or for the gantry controlling computer.
UART |
KERNELS |
Tx/Rx GPIOs |
Function |
---|---|---|---|
0 |
|
Access to Login Shell |
|
1 |
Reserved for Bluetooth |
||
2 |
|
– / – |
|
3 |
|
|
– / x-Axis Motor |
4 |
|
|
Debug Port / y-Axis Motor |
5 |
|
|
Telemtry / z-Axis Motor |
Pinout
UART Rule
Create the file /etc/udev/rules.d/50-serial.rules
with the following content:
KERNEL=="ttyAMA[0-9]*", GROUP="dialout", ENV{SERIAL_MARKER}="fcu_serial"
ENV{SERIAL_MARKER}=="fcu_serial", SUBSYSTEM=="tty", KERNELS=="fe201800.serial", SYMLINK+="fcu_debug"
ENV{SERIAL_MARKER}=="fcu_serial", SUBSYSTEM=="tty", KERNELS=="fe201a00.serial", SYMLINK+="fcu_tele"
KERNEL=="ttyAMA[0-9]*", GROUP="dialout", ENV{SERIAL_MARKER}="motor_serial"
ENV{SERIAL_MARKER}=="motor_serial", SUBSYSTEM=="tty", KERNELS=="fe201600.serial", SYMLINK+="motor_x"
ENV{SERIAL_MARKER}=="motor_serial", SUBSYSTEM=="tty", KERNELS=="fe201800.serial", SYMLINK+="motor_y"
ENV{SERIAL_MARKER}=="motor_serial", SUBSYSTEM=="tty", KERNELS=="fe201a00.serial", SYMLINK+="motor_z"
You can apply these changes by
sudo udevadm control --reload-rules && sudo udevadm trigger
To check, that the rule is applied correctly, you can execute
ls /dev/fcu* -l
ls /dev/motor* -l
The output should show symbolic links for the serial devices:
lrwxrwxrwx 1 root root 7 Dec 11 14:57 /dev/fcu_debug -> ttyAMA1
lrwxrwxrwx 1 root root 7 Dec 11 14:57 /dev/fcu_tele -> ttyAMA2
lrwxrwxrwx 1 root root 7 Aug 7 01:00 /dev/motor_x -> ttyAMA2
lrwxrwxrwx 1 root root 7 Aug 7 01:00 /dev/motor_y -> ttyAMA3
lrwxrwxrwx 1 root root 7 Aug 7 01:00 /dev/motor_z -> ttyAMA4
Note
The ttyAMA
numbers might differ, depending on the UARTs you have activated.
Identify KERNELS
To identify the KERNELS paramter of a certain ttyAMA
device, execute the following command.
udevadm info --name=/dev/ttyAMA1 --attribute-walk
1looking at device '/devices/platform/soc/fe201800.serial/tty/ttyAMA1':
2KERNEL=="ttyAMA1"
3SUBSYSTEM=="tty"
4DRIVER==""
5
6looking at parent device '/devices/ platform/soc/fe201800.serial':
7KERNELS=="fe201800.serial"
8SUBSYSTEMS=="amba"
9DRIVERS=="uart-pl011"
10ATTRS{driver_override}=="(null)"
11ATTRS{id}=="00241011"
12ATTRS{irq0}=="14"
13
14looking at parent device '/devices/ platform/soc':
15KERNELS=="soc"
16SUBSYSTEMS=="platform"
17DRIVERS==""
18ATTRS{driver_override}=="(null)"
19
20looking at parent device '/devices/ platform':
21KERNELS=="platform"
22SUBSYSTEMS==""
23DRIVERS==""
Attention
The ttyAMAx
number is not specific for the UART device and depends on how many UARTs are activated.