Hello, I’m just trying to get some of the queries described in the docs to work.
If I send over “R4” I would expect a baud rate to be reported back, but nothing.
Same if I query any of the analog inputs, the Q, or QP commands.
In the servo sequencer I do see a value in the bar for the analog input A, although nothing is connected to A on the board.
Finally, is there a way to get the board version with a command like “ver” or read the registers?
The board does respond to P commands to control the servos just fine.
If you want to try Lynxterm (free diagnostic tool for SSC-32/SSC-32U), you can get a copy here.
Since you mention your board being able to control servomotors, the most likely reason why you get no serial answers would be because you do not have the SSC-32U powered properly when trying to communicate with it. Please note that the USB connection only powers the USB interface, not the on-board electronics. The board required at least 6 V DC on VS1 to power the circuit properly (and therefore respond). A quick test for this is to check the blue PWR LED near the screw terminals: if it is not on, the board is not powered (this LED is tied to the internal logic voltage). Also, you can press once quickly (i.e: do not hold it long) the BAUD button near the BEE socket/LED A/B. If one or both LEDs blink, then you have a properly working board.
Floating inputs are subject to noise. Analog input are particularly vulnerable. If you intend on using an input pin, you should always have a value tied to it. For digital signals, this usually means having either a weak (~10-30 kOhm) pull-up or pull-down resistor attached to the input pin. This will force the input to always have a fixed value and protect it from noise changing it. For analog systems, it gets a bit more complicated, but weak pull up/down can still be a helpful solution, especially if the output being measured is sometimes disconnected/tri-stated/etc (i.e.: not providing an output, leaving the input vulnerable to noise).
See the image above. The command is literally VER!
Very good!
We strongly recommend that you review the SSC-32U manual, especially the sections concerning power and commands.
Interesting, thanks. LynxTerm receives the messages back from the queries just fine. Our .NET implementation doesn’t.
Power’s all good and the board seems just fine.
The terminal i was using was only looking for line feed for the terminator. Odd thing is that sometimes I get “SSC-32V2.5USB” and sometimes only part of that string. Good enough, though.
Thanks!
And nix that issue with the string being only a part. Apparently the ssc-32u just needed a longer read/write timeout. Interesting that my arduino’s ok at a timeout of 1ms, but the SSC-32U needs 10ms. Not a big deal though.
Concerning code, you may want to have a look here for examples of using the SSC-32U with some Python, .NET and Arduino.
As for timeout, please see the manual (pages 36+) for details about the registers. There is a default transmit delay value.
It should also be noted that some queries may have delays of a few µs to multiple ms (~5 ms at most, typically) depending on the current state of the SSC-32U and what info requested.
Thanks, didn’t see those default values in the registers. But if the default is 600uS then that’s still less than 1ms timeout that I had and was truncating the responses. Maybe my registers aren’t at default anymore, I’ll have to check. Thanks again.
Thanks for the code samples, we’re pretty familiar with those. What we’re trying to do is firm up our Unity3D integration which uses a truncated version of .NET/Mono and has problematic serial port coms. I’ve got everything straightened out that I wanted to. The entire issue was just that I had too short of a read timeout. 10ms won’t hurt anything so I’m ok with that.
On the other side, though. What’s the fastest that commands can be sent? We’ve been OK at sending them quite frequently (like faster than every 2ms), but sometimes the arm will lock up a little. I’m assuming that we’re flooding it. What would you recommend as a max on the transmission to the SSC-32U?
When/if the SSC-32U gets overloaded with commands will depend on where it is in its state machine producing the signals and interpreting the commands. We do not have specific/hard data on this, but commands every 2 ms will most likely be too much. Assuming 5 ms per command might be better for this board. More trial and error will be required on your end to determine exactly what works for your project. You may also want to make sure to use a higher baud rate to reduce delay in transmission, too, such as using 115200 baud rate (if you were still using 9600).
Also, please note that desktop OS can insert delays when reading virtual serial ports (many layers of abstraction there) since they are not real-time OSes. Therefore, you can easily get multiple ms of delays randomly in an unpredictable manner. If you combine this with delays from the SSC-32U responding, you can easily have timeouts if your timeout delay is too low.
As a secondary note, for having worked in .NET with serial ports extensively, they do have caveats in their core implementation that can make them unreliable in some cases. It is quite possible some of those are also present in the implementation of those libraries used in Unity (or new ones!). It may be better to build a proper C++ (or other language) interface for the COM port with a .NET wrapper if you can spare the time.
Yup, definitely using 115200 baud. Other speeds were too low for our use case. If I had time I’d definitely write a C++ wrapper for the com port. Just no time and what I have for Unity’s .NET is working well at the moment.
Thanks!
Feel free to post (if you can) about your project here or/and here. We are certain the RobotShop community would be interested in what you are building.