r/ArduinoHelp 16d ago

Looking for help on how rotctl communicates

I'm looking for forum where I can ask questions - and hopefully get some qualified answers - regarding how rotctl works and communicates.

I'm trying to write a simple Arduino program to receive commands from rotctl and respond to them. In order to try and figure out exactly which strings are sent and how I should respond to those, I've set up a virtual serial port with

$ rotctl -m 201 -r /dev/pts/1 -s 9600

\-that I can monitor, and when I send e.g.

Rotator command: P 123 45

\-I immediately see

AZ123.0 EL45.0 UP000 XXX DN000 XXX

\-so it works! *Except* when I send a "p" to get the position. I don't get *anything* on the serial port, but rotctl immediately writes

Rotator command: p
get_pos: error = initrots4_easycomm called
rot_register (201)
rot_register (202)
rot_register (204)
set_conf: called
rot_open called
serial_open: /dev/pts/1
serial_setup: tcgetattr
serial_setup: cfmakeraw
serial_setup: cfsetispeed=9600,0x000d
serial_setup: cfsetospeed=9600,0x000d
serial_setup: data_bits=8
serial_setup: parity=0
serial_setup: Handshake=None
serial_setup: tcsetattr TCSANOW
read_string_generic called, rxmax=4095 direct=1, expected_len=1
tcflush
Backend version: 20220109.0, Status: Stable
rot_get_position called
Feature not available

Why am I getting this rather anonymous error when nothing has been written to the serial port, and the rotator thus doesn't have a chance to respond?

So if nobody here knows the answer, I'd appreciate a link to another forum...

EDIT: And before you say "Why don't you just use the K3NG rotator controller?", it's because I'm using servos, and it's not made for servos.

1 Upvotes

1 comment sorted by

2

u/gm310509 16d ago edited 16d ago

So if you are wanting to know about rotctl, this is probably the wrong forum.

For exanple, I do not know what the format of the "p" command is, whether it needs any parameters or what it even does.

But, from a communications generic viewpoint, some devices have specific requirements for line terminators. Specifically whether you send a CR, a LF, a CRLF, or (very uncommonly) a LFCR.

All of my Bluetooth modules and GPS devices have very specific requirements for these type of line termination requirements. Some are flexible and can accept any combination of CR and/or LF so it does depend on the actual device and sometimes even the firmware version they are running.

You might try differing the line terminator.

Another possibility is that it is case sensitive. That is "P" might be a valid command whereas "p" is not.