How to read digital input from SSC-32 v2 (ABCD ports)?

Good day, RobotShop community.

Some months ago I got a Rover A4WD1 w/Encoders from here:
robotshop.com/en/lynxmotion- … oders.html

Alongside a Phidgets SBC3 (Minimal Debian OS) and a SSC-32 v2 (Serial).
I managed to get the DC motors of the Rover working just fine with the Serial communication through the SSC-32.

However, the problem comes when trying to read any kind of input (Digital or Analog) from the ABCD ports of the SSC-32 v2.
I am trying to get a signal which is supposed to be a binary character (ASCII) of either 0 or 1 depending on the value of the encoder of the Rover.
(Here’s a page of the encoder for reference: robotshop.com/en/lynxmotion- … coder.html)
The encoder seems to have a Yellow and Green cable for Output A and B.

I connected an oscilloscope into them and got an square signal as follows:

[size=4]Output A (Green cable) connected only.[/size]

[size=4]Output A and B connected both to the oscilloscope [/size]

Given the output signal I got in the oscilloscope, I am assuming this has to be a digital input.

According to the User Guide of the SSC-32 v2, the digital inputs can be read by sending ABCD into the SSC-32.
However, I seem to fail to get any kind of response out of it.

Here’s the code that I’m using to try to get it to work through serial connection connect to the Phidgets SBC3 (/dev/ttyUSB0) to the SSC-32 v2:

[code]#include
#include
#include <stdio.h>
#include <fcntl.h> /* For O_RDWR */
#include <unistd.h>
#include
#include <termios.h>
#include
#include <stdlib.h>
#define SERVO_DELAY 1000
#define Q_DELAY 10
#define RAD 57.29577951
//#define m 0.1664292499
#define md 9.535693606
#define PORT “/dev/ttyUSB0”
#define CHANNEL_NUM 10
#define STD_SPEED 250
#define BAUD_RATE " 9600"
#define PI 3.141592654
#define DELAY_ARM 20000

using namespace std;

#define phi0 0
double pos,vel;
int can;
//g++ -o input input.cpp

int main(int argc, char *argv])
{
int usbdev;
int i;
ofstream fw;
char cData[1];
unsigned char uData;

fw.open(PORT);
system(“stty -F” PORT BAUD_RATE);
usbdev = open(PORT, O_RDWR| O_NONBLOCK, S_IRUSR | S_IWUSR);

KServo p0(95,20,0); // This simply starts the DC motor at a low speed to get a signal from the encoder.

for(i=0;i=1000;i++){
fw << “A B C D” << “\r” << endl;
read(usbdev, cData, 1);
uData = cData[0];
cout << uData << " ";
}

close(usbdev);
fw.close();
}
[/code]

The part where I am trying to read from the ABCD ports is located inside the ‘for’ cycle.
Could someone help me out to figure out what is going on and why I cannot get any kind of response?

Any kind of help would be greatly appreciated.
Thanks in advance!

**PS: **The serial connection is working since I am able to control the DC motors just fine with a similar kind of code, just applying the #P, etc variants for them from the SSC-32 User Guide.

Hi,

Is your SSC-32U powered ? It should be powered through the VL screw terminals 6-12V. As it is mentioned in the SSC-32U manual :

Regards,

Hello.

Thanks for the reply.
I do have the SSC-32 powered (it’s the v2 Serial one, not the USB SSC-32U) through the VS1 ports, and I also have the jumper for providing power from VS1 to VL in the proper pins, as shown in the image below:

(Bad quality I know :stuck_out_tongue:)

But at least you can see there that the power cables are connected to VS1 and the jumper for VS1-VL is in place, so it should be providing power to the rest of the board. I could try connecting them directly to VL though just to see if it does something different.

Nope, same thing.
The cout does print the spaces and everything, but I get no ASCII character at all.

Hi,

Can you provide a clear picture showing your entire SSC-32 Board ?
Did you put jumpers on TX and RX to enable DB9 port connection (as explained in the SSC32 User Manual point 13 page 3) ?
Also note that the digital inputs on the SSC32 might not be convenient to be used with encoders as explained in the manual :

The Lynxmotion Quadrature Motor Encoder frequency is 30kHz which will be too fast for the read commands on the ABCD inputs.

Regards,

Hi bdaouas,

Here are the images, somewhat low res because the stupid camera doesn’t have focus.
I do have both jumpers in the TX and RX pins as shown on the first image, and you have one of the whole board on the second one.
If you need anymore pics or more detailed ones, let me know and I’ll try to take them with a better camera.

http://i68.tinypic.com/10zs3ft.jpg http://i63.tinypic.com/10ogww6.jpg

Hi,

To troubleshoot this issue :

]Remove all the wires you currently have on your SSC32/:m]
]Download and install LynxTerm here /:m]
]Connect power to your SSC32 through VL (6V-9V)/:m]
]Connect your SSC32 to your PC Serial Port or to USB port using a USB to Serial Adapter cable (new PCs don’t have serial ports anymore)/:m]
]Open LynxTerm, choose your COM port on which your SSC32 is connected and click connect /:m]
]Then write "A B C D " and enter, to see if your SSC32 replies to this command./:m]Regards,



Thank you for your reply.

I have downloaded the required software to test the input ports.
Also, disconnected every cable from atop the board, leaving only the power cables connected and the serial cable of course.
I had firmware version 2-01XE and was successfully getting the same output as you do:

I upgraded the software to 2-04GP just to be sure I am running the latest firmware for it, and the A B C D in LynxTerm still gives me the proper response. However, the code I posted on the OP is still not giving any kind of output from the input ports (A and B are the ones connected).

Just want to also give you my deepest gratitude for trying to help me out on this issue, as I have been struggling for weeks with it.

Hi,

The issue is most likely coming from your code. Here an Arduino sample code that uses the SSC32 Analog inputs.
Also, try to remove the “endl " after the "\r”.

Thanks for that.
I’ll give that code a throughout look to hopefully get some insight.

In the meanwhile, I tried removing the “endl” of the code, but I still get no output.
Will try to see if I can work that Arduino code to make it work with mine somehow.