NewtownGuy
Technical User
Hello,
I'm creating command strings that I sent out ttyS0 to control a robot. The strings are less than 10 bytes long and have binary data.
The problem is that every time I output a byte that happens to be 0x0A -- line feed -- a leading carriage return -- 0x0D -- gets added somewhere. This wrecks the command string.
I'm running Fedora Core 3. I'm guessing that the problem is with outputting the binary string through the COM1 / ttyS0 port because the binary log files we create are correct. If the COM port is the problem, how should we fix it ?
Here's how we configure the COM port at bootup in rc.local:
We used divisor and spd_cust to get 9600 baud because the port kept running at 115,200 when we used baud_base 9600 with the default divisor. The chown line is shown because we provide the command strings through IE through apache, and we print the command strings to /dev/ttyS0.
Thank you.
-- NewtownGuy
I'm creating command strings that I sent out ttyS0 to control a robot. The strings are less than 10 bytes long and have binary data.
The problem is that every time I output a byte that happens to be 0x0A -- line feed -- a leading carriage return -- 0x0D -- gets added somewhere. This wrecks the command string.
I'm running Fedora Core 3. I'm guessing that the problem is with outputting the binary string through the COM1 / ttyS0 port because the binary log files we create are correct. If the COM port is the problem, how should we fix it ?
Here's how we configure the COM port at bootup in rc.local:
Code:
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
setserial /dev/ttyS0 divisor 12
setserial /dev/ttyS0 spd_cust
setserial /dev/ttyS0 baud_base 115200
setserial /dev/ttyS0 close_delay 50
setserial /dev/ttyS0 closing_wait 100
chown root:apache /dev/ttyS0
chmod 666 /dev/ttyS0
We used divisor and spd_cust to get 9600 baud because the port kept running at 115,200 when we used baud_base 9600 with the default divisor. The chown line is shown because we provide the command strings through IE through apache, and we print the command strings to /dev/ttyS0.
Thank you.
-- NewtownGuy