Has someone tried to control the SSC-32 running a c++ program under Linux/Unix?
Is it just to send the strings to /dev/ttyS01 using ioctl?
How do i handle the baudrate if i open the COM-port as a file?
Is there another way of sending the commands, bitbanging for example?
I really want to get some answers to the questions before I spend my money on the servocontroller…!
I can’t answer your linux questions, since I don’t have any experience there…
But I can say that any serial communication that properly mimics an RS232 or TTL communication of the proper baud rate should do.
Bit-banging is one option.
So is a microcontroller’s UART.
A serial cable from a computer is the usual option, though.
Remember…
If you’re sending it RS232 (-12V or 12V) hook up to the DB9 connector.
If you’re sending it TTL (0V or 5V) pull off the two jumpers over the TTL connector and hook up to that.
As far as the *nix part goes the serial port just becomes a tty. I have on several occassions sent commands over to a serial device just by using a command like this:
$ echo “print Text” > /dev/ttys0
This will work in most situations, though I have never tried to control the SSC-32 in this manner. I’m basicly just a *nix Geek. I have also never written C/C++ apps that talk to the ttys since it’s so easy to do with a simple shell script.
I would think that you could indeed send string to the tty using ioctl. Just an educated hunch though, take it as you will.
Has anyone had success writing to the SSC32 using the echo command? I think I did but have forgotten how I sent the , can someone post an example command please so I can see whether I have my serial comms set right
Yes, the SCC-32 is linux controllable. In this thread: lynxmotion.net/viewtopic.php?t=1041 the author hooks his SCC-32 up to a Linksys router running OpenWRT Linux.
As I suggested in the previous thread, the issue is most likely baud rate or some other serial port settings. The SCC-32 has jumpers. You need to make sure your serial port and the board are both on the same page. You might need a utility like setserial or stty to do things on your computer’s side if you can’t get it to work in C.
The character for in echo is \r. So a sample command might be:
echo -ne “#0P1500\r” > /dev/ttyS0
Of course put whatever you serial port is instead of the one on my comp. Also try without the -ne flag, the -n prevents it from sending a \n char at the end of the string and the -e allows special chars, some versions of echo don’t do and other specials properly without it. If that doesn’t work, actually checking the output of the serial port (with another device under linux or a scope) is a good idea if you haven’t done so already.
thanks Tillin, it turned out the Baud was wrong, set to 9600 on the PC. Have dropped the baud on the SSC-32 to match as a quick fix and will increase the baud on the PC when I can - off to the pub now! ;o)
ive written a few small sample programs that run on linux, i can post the code if you would like, aslo i think i posted the first part of the code in a different thread. the code in that thread will setup the serial port and hopefully get things going
-Ian
the commands for changing the serial port baud rate from the console would be the most useful for me but I’m sure that others would appreciate the lot - Thanks
will cause setserial to output the info of the serial port in a way that it could be fed back into setserial. Useful to pipe to a file somewhere so you can restore all the settings should you foul it up.
setserial -a /dev/ttyS0
will output in a more human readable form. This is the output on my machine from both:
Mine happens to already be already set to 9600, but if you needed to set the baud_rate to 9600 (which is apparently the mode the SCC-32 and Linux definitely work at, nobody on the forum seems to have successfully tried anything higher), it’s really easy, just