Access to ssc32 on linux hangs the controller

hello
I connect on linux to ssc32 using next parameters:

    termios tio;
    tio.c_cflag = BAUD | CRTSCTS | DATABITS | STOPBITS | PARITYON | PARITY | CLOCAL | CREAD;
    tio.c_iflag = IGNPAR/* | ICRNL carsh occur!*/;
    tio.c_oflag = 0;
    tio.c_lflag = ICANON;

But the problem is:when I send “ver” command, and then “0 P1000”, servo doesn’t move, but green LED on card blinks. So, the only way to make device work is to switch power off/on.
So, is my connect parans is correct?

I know nothing about Linux, but it looks like you may be having a power issue. The LED should go out after it receives a valid command. Then it should blink only when reveiving a command. Does the LED stay off, or come back on?

I also know nothing about such things.
Could it be, though, that you forgot a carriage return?

Led is turned off and blinks only if I send command to ssc32. Other words, “ver” or other input command stops any movenet commands like “0 P1000” and etc

You need to be more clear on what you are actually sending. At this stage we just can’t assume you’re doing it right. You say you are sending “0 P1000” but that is not correct. The correct way to send data is like this “#0 P1000, cr” Where cr is a carriage return. Also your program needs to pause between moves to give the servo time to actually move. Asking the controller for the version does not effect the movement of servos in any way. Please show us more accurately the data you are sending to the SSC-32.

Aye, all feedback responses from the SSC-32 are postponed until there’s free time between servo sendings.

Feel free to upload a picture of your setup, and we’ll take a peek.

here is how i connect using linux in C …

#include <termios.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/signal.h>
#include <sys/types.h>

#define BAUDRATE B38400
#define MODEMDEVICE /dev/ttyUSB0


int main()
{
	int fd;
	struct termios oldtio, newtio;

	fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY);
	if (fd < 0)
		{
		printf("error\n");
		//perror(MODEMDEVICE);
		exit(-1);
		}
		
	tcgetattr(fd, &oldtio);
	bzero(&newtio, sizeof(newtio));
	printf("test1\n");
	newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD;
	//newtio.c_cflag = BAUDRATE | CRTSCTS | CS8;
	newtio.c_iflag = IGNPAR | ICRNL;
	newtio.c_oflag = 0;
	newtio.c_lflag = ICANON;
	tcflush(fd, TCIFLUSH);
	tcsetattr(fd, TCSANOW, &newtio);
	

	//do stuff here
		write(fd, "#0P1500#1P1500#2P1550T1000\r", 27);
		usleep(1000000);


	//close up the port
	tcsetattr(fd, TCSANOW, &oldtio);
	close(fd);
	return 0;
}

note the usleep at the end of the command, otherwise your command wont complete before you issue your next command, hopefully this will help you out some

Although you code looks fairly good, it may not properly to set parity or stop bits. This may be a problem. Unfortunately the SCC-32 manual doesn’t seem to indicate what it needs. My guess being a micro is that it needs 8 p1 n2. I bold that since most computer serial ports are set to 8 p1 n1 by default. See comptechdoc.org/os/linux/programming/c/linux_pgcserial.html for a general how-to program for all the serial port settings in Linux.

I don’t know how much experience you have with port programing (I’m not an expert either) but since you’re using a USB to serial adapter, things may become trickier than a normal serial port. If you haven’t tested your port with either a simpler device like a serial lcd or better an oscilloscope (you can litterally see things like stop bits), I would do that first.

Of course you should check the jumper settings on the SCC-32 (both baud rate and inversion), but I’m assuming you did this. If all else fails, try just doing a single move (you code is currently doing a group move), or first sending the commands via the command line with echo. This may be slow, but should limit all variables, it may be a real hardware issue with the SCC-32.

Wish I had my SCC-32, I need to write Linux C servo control too. :slight_smile:

8 data bits
1 stop bit
No parity
No flow control