USB 16 Servo Controller Linux

Hello!

I cant make my Pololu USB 16 to work on Linux Ubuntu. I am quite sure that my problem is my port settings.
I have seen the example code using the termios structure, but I’m used to use open ports using fopen and I would like to do so in this project too (fopen opens streams).
I started testing my code on my macbook running osX. The program runs without problems, and it shows that the Pololu USB 16 Servo Controller is a great servo controller! Now i want it to work on my small linux computer too!

Once I run the program on the linux machine, the red LED is lit and the yellow led flashes, indicating too slow baudrate. Although, its not the baudrate. I have tried baudrates from 9600 up to 57600, and it works just fine with 9600 baud on my macbook.

I think the trick is to get all the flags correct using stty -F /dev/ttyUSB0.
Can anyone please post ALL the stty flags from a correct set up port, i.e. from a functional USB 16 Servo Controller.

This command gives ALL the stty flags:
stty -F /dev/ttyUSB0 -a

These are my current settings: (I’m using ttyUSB1)

rex@trex:~/ctl$ stty -F /dev/ttyUSB1 -a
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke

Thank you in advance!

EDIT: I have tried the code snippet from lukelukeluke which is using the termios struchture with the same result. Red LED lit, yellow LED flashing. :frowning:

The problem is my computer, not my code.
I tried the code on an other linux computer and it worked great…
These stty flags worked grat with my Pololu USB 16 Servo Controller: (print screen)


Yes, I used USB0 this time, and I did not change the address in my servo_close()

Great, I’m glad you managed to get it working after all. Do you know what the problem was with the first computer?

-Paul

I’m afraid not… I have set ALL the flags exactly the same, but it’s still not running. I don’t really know what to do at this point, but I’ll post here when (if) I get it to work!

:confused:

I just read over this forum because I’m having trouble finding a code that will allow me to talk to the same servo controller on a mac. I am more of a beginner when it comes to writing code, so I’m sure the error is in the code I’m writing. I was hoping that I could get some help with exactly what the code should look like that you used on your Mac. I generally work with C++ but any language will pretty much help. Thanks.

-Matt

Hello,

Matt seems to be discussing this same question over at this topic. Let’s continue the discussion about C++ servo controllers programs on the Mac over there.

- Ryan