Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SITL] Update SITL serial proxy posix port setting #12

Conversation

stronnag
Copy link

@stronnag stronnag commented Nov 4, 2023

Update the configuration of the serial port to support "non-standard" baud rates on POSIX platforms (tested on Linux, MacOS and FreeBSD).

@stronnag
Copy link
Author

stronnag commented Nov 4, 2023

Test Status

Linux (Arch, aarch64, riscv64, x86_64; Alpine ia32)

CRSF (ELRS)

via pl2303 (FTDI clone)

$ ./inav_7.0.0_SITL --path ~/sitl-eeproms/crsf-eeprom.bin --serialuart=3 --serialport /dev/ttyUSB0 --baudrate 400000
INAV 7.0.0 SITL (5a785a44)
[SYSTEM] Init...
[SIM] No interface specified. Configurator only.
[SERIALPROXY] Connected /dev/ttyUSB0 to UART3
[EEPROM] Loaded '/home/jrh/sitl-eeproms/crsf-eeprom.bin' (32768 of 32768 bytes)
[SOCKET] Bind TCP [::]:5760 to UART1
[SOCKET] Bind TCP [::]:5761 to UART2
[SOCKET] Bind TCP [::]:5762 to UART3
[SOCKET] [::1]:40896 connected to UART1
[SOCKET] [::1]:40896 disconnected from UART1

IBUS

via CP2102

$ ./inav_7.0.0_SITL --path ~/sitl-eeproms/ibus-eeprom.bin --serialuart=3 --serialport /dev/ttyUSB0 --baudrate 115200
INAV 7.0.0 SITL (5a785a44)
[SYSTEM] Init...
[SIM] No interface specified. Configurator only.
[SERIALPROXY] Connected /dev/ttyUSB0 to UART3
[EEPROM] Loaded '/home/jrh/sitl-eeproms/ibus-eeprom.bin' (32768 of 32768 bytes)
[SOCKET] Bind TCP [::]:5760 to UART1
[SOCKET] Bind TCP [::]:5761 to UART2
[SOCKET] Bind TCP [::]:5762 to UART3
[SOCKET] [::1]:37446 connected to UART1
[SOCKET] [::1]:37446 disconnected from UART1

FC Proxy (Sbus RX/TX)

$ ./inav_7.0.0_SITL --path ~/sitl-eeproms/sim-eeprom.bin --serialport /dev/ttyACM0 --fcproxy
INAV 7.0.0 SITL (5a785a44)
[SYSTEM] Init...
[SIM] No interface specified. Configurator only.
[SERIALPROXY] Using proxy flight controller on /dev/ttyACM0
[EEPROM] Loaded '/home/jrh/sitl-eeproms/sim-eeprom.bin' (32768 of 32768 bytes)
[SOCKET] Bind TCP [::]:5760 to UART1
[SOCKET] Bind TCP [::]:5761 to UART2
[SERIALPROXY] Requesting RX config from proxy FC...
[SERIALPROXY] Setting RX config on proxy FC...

Correct movement of sticks etc. seen in Configurator.

FreeBSD (x64_64)

IBUS

via CP2102

$ ./inav_7.0.0_SITL --path ~/sitl-eeproms/ibus-eeprom.bin --serialuart=3 --serialport /dev/cuaU0 --baudrate 115200
INAV 7.0.0 SITL (5a785a44)
[SYSTEM] Init...
[SIM] No interface specified. Configurator only.
[SERIALPROXY] Connected /dev/cuaU0 to UART3
[EEPROM] Loaded '/home/jrh/sitl-eeproms/ibus-eeprom.bin' (32768 of 32768 bytes)
[SOCKET] Bind TCP [::]:5760 to UART1
[SOCKET] Bind TCP [::]:5761 to UART2
[SOCKET] Bind TCP [::]:5762 to UART3
[SOCKET] [2a02:8010:6287:0:18b0:85ff:fe48:a70f]:36908 connected to UART1
[SOCKET] [2a02:8010:6287:0:18b0:85ff:fe48:a70f]:36908 disconnected from UART1

CRSF (ELRS)

via pl2303 (FDTI clone)

./inav_7.0.0_SITL --path ~/sitl-eeproms/crsf-eeprom.bin --serialuart=3 --serialport /dev/cuaU0 --baudrate 400000
INAV 7.0.0 SITL (5a785a44)
[SYSTEM] Init...
[SIM] No interface specified. Configurator only.
[SERIALPROXY] Connected /dev/cuaU0 to UART3
[EEPROM] Loaded '/home/jrh/sitl-eeproms/crsf-eeprom.bin' (32768 of 32768 bytes)
[SOCKET] Bind TCP [::]:5760 to UART1
[SOCKET] Bind TCP [::]:5761 to UART2
[SOCKET] Bind TCP [::]:5762 to UART3
[SOCKET] [2a02:8010:6287:0:18b0:85ff:fe48:a70f]:59058 connected to UART1
[SOCKET] [2a02:8010:6287:0:18b0:85ff:fe48:a70f]:59058 disconnected from UART1

Correct movement of sticks etc. seen in Configurator.

MacOS (x64_86 kvm/qemu)

IBUS

via CP2102

$ ./inav_7.0.0_SITL --path ~/sitl-eeproms/ibus-eeprom.bin --serialuart=3 --serialport /dev/cu.usbserial-0001 --baudrate 115200
INAV 7.0.0 SITL (5a785a44)
[SYSTEM] Init...
[SIM] No interface specified. Configurator only.
[SERIALPROXY] Connected /dev/cu.usbserial-0001 to UART3
[EEPROM] Loaded '/Users/jrh/sitl-eeproms/ibus-eeprom.bin' (32768 of 32768 bytes)
[SOCKET] Bind TCP [::]:5760 to UART1
[SOCKET] Bind TCP [::]:5761 to UART2
[SOCKET] Bind TCP [::]:5762 to UART3
[SOCKET] [::ffff:172.31.0.244]:51594 connected to UART1
[SOCKET] [::ffff:172.31.0.244]:51594 disconnected from UART1

Correct movement of sticks etc. seen in Configurator.

CRSF not tested as environment does support pl2303/400000 baud (however, stty reports correct tty settings after SITL started with --serialuart=3 --serialport /dev/cu.usbserial-5D20 --baudrate 400000

$ stty < /dev/cu.usbserial-5D20
speed 400000 baud;
lflags: -icanon -isig -iexten -echo
iflags: -icrnl -ixon -ixany -imaxbel -brkint
oflags: -opost -onlcr -oxtabs
cflags: cs8 -parenb clocal
min
0

@stronnag
Copy link
Author

stronnag commented Nov 4, 2023

@RomanLut please note, Windows has been re-tested (working at 115200, which is all I can easily test).

@RomanLut RomanLut changed the base branch from master to submit-serial-receiver November 4, 2023 16:21
@RomanLut RomanLut merged commit 662fc78 into RomanLut:submit-serial-receiver Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants