troubles communicating with SB 5000 ser in terminal

SpaceOrb motion sensor technology is the name of the game...
Forum rules
bnemec
Posts: 6
Joined: June 03 2013, 15:19 PM
Location: Wisconsin USA

troubles communicating with SB 5000 ser in terminal

Postby bnemec » June 03 2013, 15:25 PM

I confess, this is a duplicate post from 3Dconnexion Forums. It's been there a few days and I was reccomended this forum by Tehrasha Darkon.



Hello, I was hoping to use a 4000 FLX (I think it also goes by 5000 FLX-A or 5000 serial) as a HMI on different microcontroller based projects. It is branded IBM. I have no desire for using it on PC, I have a slightly newer USB model for that. To get started however I'm trying to communicate using CuteCom (I wish there was linux equiv of Brey Term) anyways I can only get button packets, no axis data. I've scoured driver code from SpaceOrb, Orbduino, spacenavd and probably others looking for help. I've tried two init strings "\rCB\rNT\rFT?\rFR?\rP@r@r\rMSSV\rZ\rBcCcCcC\r" and "\rm3\rpBB\rz\r" both of them cause the device to stop sending even button events until I close and reopen the comm port. I have uninstalled all drivers and programs relating to space mice or 3d connexion. I'm running 9600, 8, N, 1; although I've tried the other bauds as well.



I know that the serial devices are no longer supported and that I should throw them away, I've read that many times. Problem is using USB to communicate with a microcontroller is doable, but UARTs are much more straight forward.



Thanks for your time,



Ben Nemec

vputz
Posts: 341
Joined: March 25 2006, 20:21 PM
Contact:

Re: troubles communicating with SB 5000 ser in terminal

Postby vputz » June 04 2013, 1:15 AM

Ben:



Yep, as I'm sure you've been told the "buttons but no axes" is generally a lack of init string. Unfortunately the code for initializing a 4000FLX in the Orbotron is indeed


[code]
Serial1.print("\rCB\rNT\rFT?\rFR?\rP@r@r\rMSSV\rZ\rBcCcCcC\r");
[/code]


...just like you've tried, so I'm a little curious. When you send that you should get two beeps and start getting packets.



Though you know, there is one other time I've seen "buttons but no axes", although if you're using a standard RS232 port I'd be surprised. Still, worth a look... particularly if you're using a USB-to-serial adaptor.



This happened with Orbotron development a few times. The old serial orbs--at least the SpaceOrb 360 and I'm pretty sure the 4000/5000 series--seemed to require a good 9-10v out of the RS232 port. If you supplied less than that (say, 5v like you would get from a USB-powered Orbotron...) it would give the device enough power to detect button presses but not enough to power the orb sensor.



In fact this was such a problem with the original SpaceOrb 360 and dodgy PC serial ports that someone had actually invented a battery boost for it just to generate enough power. A couple times in the Orbotron development I would use an IC that I thought would work and then realize it wasn't putting out 9-10v and I was just getting button packets.



Now, I don't know if that's your problem (and if you're plugging it into an old PC motherboard I'd guess not) but if it's a USB-to-serial adaptor or some such, think about trying a multimeter between... I think it's pins 4/5 (on the "long row" of the db9, it's one of the two ends). See what voltage you're getting.

VDX
Posts: 18
Joined: February 12 2013, 16:47 PM

Re: troubles communicating with SB 5000 ser in terminal

Postby VDX » June 04 2013, 2:11 AM

... heard the same about 5V-sources with not sifficient amperages (below 300mA?).



Have running my 4000 Flx's fine with 'real' serial ports in a virtual-box-WinXP under Win7-ultimate, but need the connexion adapter with external 5V wall-plug for RS232-USB-converters ...



Viktor

bnemec
Posts: 6
Joined: June 03 2013, 15:19 PM
Location: Wisconsin USA

Re: troubles communicating with SB 5000 ser in terminal

Postby bnemec » June 04 2013, 10:29 AM

Thanks guys, I had this pluged in to serial port of old desktop (Dell OptiPlex GX270). So I took the other Space Ball and hooked it up to wife's Dell Latitude D820 laptop (also older with serial port). When I open port on that one it I think it has problems because it keeps trying to send the 0x00 and 0x80 startup bytes, but never completes. Just keeps repeating the two beeps over and over. I'm guessing that the laptop isn't providing sufficient power.



I was going to check for power on the lines, now I'm not sure which line to check. Do I assume it's pin 4 (DTE ready) on a Dsub9 that provides power? I've always had my development boards powered from wall wart. Also, is there some breakdown of the init string? I think I read some where that "\r" is supposed to reset? Even sending that locks up the SpaceBall.



Thanks again,



Ben

vputz
Posts: 341
Joined: March 25 2006, 20:21 PM
Contact:

Re: troubles communicating with SB 5000 ser in terminal

Postby vputz » June 04 2013, 16:46 PM

I'm not completely positive on the "right" way; for whatever reason, I provide power on both pins 4 and 7 (5 is ground). I think there was some reason I thought 7 (RTS) was a good idea, but I can no longer remember it; 4 (DTR) is probably fine.



Nevermind, found a reference on Wikipedia: "No method is specified for sending power to a device. While a small amount of current can be extracted from the DTR and RTS lines, this is only suitable for low power devices such as mice." I figured I'd be safe and power both of 'em.



I don't know about the reset string either (another case of "I once did but once it started working I lost track of why"). Best of luck--sorry it's giving you trouble!

Tehrasha
Posts: 26
Joined: May 19 2013, 19:37 PM
Location: Midwest, USA
Contact:

Re: troubles communicating with SB 5000 ser in terminal

Postby Tehrasha » June 04 2013, 18:55 PM

[quote="vputz"]"No method is specified for sending power to a device. While a small amount of current can be extracted from the DTR and RTS lines, this is only suitable for low power devices such as mice." I figured I'd be safe and power both of 'em.[/quote]

This is one of the downfalls of many cheap USB/Serial adapters, the UART they use either does not support DTR/RTS properly, or they do not supply enough current for legacy devices that require it.



-EARLY- Spaceballs 1003/2003/3003 models needed more power than even -real- serial ports of the day could provide, and required a 9v wall-wart and custom patched serial cable. Later models 2003C/3003C were redesigned to use less power and ditched the wall-wart.
[color=#BF0000][b][url=http://spacemice.org/]Spacemice[/url] -- Input Devices for a 3D World[/b][/color]

bnemec
Posts: 6
Joined: June 03 2013, 15:19 PM
Location: Wisconsin USA

Re: troubles communicating with SB 5000 ser in terminal

Postby bnemec » June 04 2013, 23:52 PM

So I finally broke down and installed wine so I could run Br@y++ Terminal. [url]https://sites.google.com/site/terminalbpp/[/url] Now I have complete controll over my com port :twisted: or so I think...



Found that both the DTR and RTS need to be on to power up the device, but after that it will send button events as long as the RTS is on. If RTS is turned off and DTR is left on, it will buffer button events untill you turn the RTS back on. Makes sence... But it still won't accept any input without locking up. So I hacked together a serial cord that powers pins 4 and 7 to 5v from a USB cord. I used dip switches to be able to control them. I powered using a phone charging USB wall-wart that is rated at 5.1v and .7A so that should be suffucient. I killed my DMM a while ago and haven't replaced it yet. :x Any ways I did more searching and I found this handy bunch of code. Incase anyone is interrested... [url]http://code.google.com/p/vrjuggler/source/browse/modules/gadgeteer/drivers/3Dconnexion/SpaceBall/puck_device.cpp?r=82fad74e63d068a484a8882fecf13cf8ae63d227[/url]



I'll keep plugging away and try to figgure something out. Maybe be best just to junk them...



I think I asked, but is anyone using this with IBM branded 4000FLX? Could they have used a proprietary init string? :(

bnemec
Posts: 6
Joined: June 03 2013, 15:19 PM
Location: Wisconsin USA

Re: troubles communicating with SB 5000 ser in terminal

Postby bnemec » June 05 2013, 0:09 AM

I think my balls are busted... :shock:

Tehrasha
Posts: 26
Joined: May 19 2013, 19:37 PM
Location: Midwest, USA
Contact:

Re: troubles communicating with SB 5000 ser in terminal

Postby Tehrasha » June 05 2013, 1:57 AM

[quote="bnemec"]I think I asked, but is anyone using this with IBM branded 4000FLX? Could they have used a proprietary init string? :([/quote]

AFAIK, no. INIT strings are the same, the Firmware Ident that they return may differ though.



Does Terminal let you see all of the serial traffic to and from the spacemouse?

If so, does it ever spit this back at you?


[code]Firmware version 2.42 created on 24-Oct-1997[/code]
[color=#BF0000][b][url=http://spacemice.org/]Spacemice[/url] -- Input Devices for a 3D World[/b][/color]

bnemec
Posts: 6
Joined: June 03 2013, 15:19 PM
Location: Wisconsin USA

Re: troubles communicating with SB 5000 ser in terminal

Postby bnemec » June 05 2013, 10:26 AM

I never recieved that, and AFAIK Br@y++ Term does show [i]everything[/i] in and out of the port.



Here is the typical repsonce from both 4000 FLX. Actually this is what I always get.



Upon power-up this is sent. Kinda reminds me of baud detection timing packets?
[code]00 80 80 80 00 00 00 80 80 00 80 00 80 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 80 00 00 80 80 00 00 80 80 00 00 00 80 00 80 80 00 80 00 80 00 80 00 80 80 00 00 00 80 00 00 80 00 80 00 80 00 80 80 00 80 00 80 00 80 00 80 00 00 00 00 00 80 00 80 80 80 80 80 00 80 80 [/code]

Here is buttons 1-12 (1-9 and A B C) I didn't bother with lefty button:
[code]
press packet | release packet
4B 40 41 0D 2E 40 41 0D 4B 40 40 0D 2E 40 40 0D
4B 40 42 0D 2E 40 42 0D 4B 40 40 0D 2E 40 40 0D
4B 40 44 0D 2E 40 44 0D 4B 40 40 0D 2E 40 40 0D
4B 40 48 0D 2E 40 48 0D 4B 40 40 0D 2E 40 40 0D
4B 41 40 0D 2E 40 50 0D 4B 40 40 0D 2E 40 40 0D
4B 42 40 0D 2E 40 60 0D 4B 40 40 0D 2E 40 40 0D
4B 44 40 0D 2E 40 C0 0D 4B 40 40 0D 2E 40 40 0D
4B 50 40 0D 2E 41 40 0D 4B 40 40 0D 2E 40 40 0D
4B 40 40 0D 2E 42 40 0D 4B 40 40 0D 2E 40 40 0D
4B 40 40 0D 2E 44 40 0D 4B 40 40 0D 2E 40 40 0D
4B 40 40 0D 2E 48 40 0D 4B 40 40 0D 2E 40 40 0D
4B 40 40 0D 2E 50 40 0D 4B 40 40 0D 2E 40 40 0D
[/code]


I don't understand what the two bytes after the 0x4B or 'K' are about. But from what I can tell the two bytes after the 0x2E or '.' follows what I've read about button - bit mapping. Bit 6 of both bytes is always 1 bit 7 of byte 2 is always 0 Here is a nice bit of code comment from the link I posted above
[code] /* Buttons are represented by following bits:

Bit: 7 6 5 4 3 2 1 0
--------------------------------------
Meaning:
(First Byte)
0 1 <L> <12> <11> <10> <9> <8>

(Second Byte)
<7> 1 <6> <5> <4> <3> <2> <1>

e.g. The higher 4 bits of the first byte are always 01xy, where
x = the 'left-handed' mode of the SpaceBall, and
y = the on/off state of button 12
*/[/code]

bnemec
Posts: 6
Joined: June 03 2013, 15:19 PM
Location: Wisconsin USA

Re: troubles communicating with SB 5000 ser in terminal

Postby bnemec » June 07 2013, 0:51 AM

I'm stupid... :oops:



I reread almost everything I had saved including this topic. Tehrasha's comment about seeing >everything< that went in and out of the port kept bothering me. So I studied up the terminal program I was using. Sure enough, my assumptions made a... well you get the idea. I assumed the terminal was parsing the escape character, and it wasn't. So instead of sending the acutal carrige return, 0Dh, I was sending the two characters \ and r. Thinking back now, I don't know why the ---- I would think that. Just like every other time I start "spinning my wheels," it's something so stupid, and how can someone help me trouble shoot that? :roll:



Anyways I'm getting ball data now. A few commands I've picked up:



@ causes software reset, outputs the stauts and firmware

MSSV starts sending data from ball

P sets the refresh rate of ball, I've seen @r@r and 32 for values, not sure if there is one for Translation and one for Rotation or how that works, but trial and error does prove a change in update speed.

B causes the double beep, tried others like BcCcC and couldn't tell any diff.



Oh, and it will send ball data with the DTR line off for a very short while, then two beeps and it tries to restart but it's erratic untill both DTR and RTS are on. So it sounds like it needs both to get enough power for transmitting ball data packets.



I do apologize for wasting your guy's time over my silly mistake.



Ben

vputz
Posts: 341
Joined: March 25 2006, 20:21 PM
Contact:

Re: troubles communicating with SB 5000 ser in terminal

Postby vputz » June 07 2013, 2:11 AM

Haha, yay!



You didn't waste our time, and you are NOT stupid; this sort of thing happens all the time! I've lost count of the ridiculous mistakes I've made developing the Orbotron or any other thing. Great job figuring it out! And posting to a board even if we weren't directly helpful is sometimes still useful... I can't count the number of things I've figured out after asking for help and getting none--just the action of asking the question can help clarify thoughts.



Nice work!

Tehrasha
Posts: 26
Joined: May 19 2013, 19:37 PM
Location: Midwest, USA
Contact:

Re: troubles communicating with SB 5000 ser in terminal

Postby Tehrasha » June 07 2013, 3:28 AM

[quote="bnemec"]
Anyways I'm getting ball data now. A few commands I've picked up:



@ causes software reset, outputs the stauts and firmware

MSSV starts sending data from ball

P sets the refresh rate of ball, I've seen @r@r and 32 for values, not sure if there is one for Translation and one for Rotation or how that works, but trial and error does prove a change in update speed.

B causes the double beep, tried others like BcCcC and couldn't tell any diff.
[/quote]


Glad I could help? :)



I'm sure you have stumbled across these, but just in case...

[url=http://lists.unc.edu/read/attachment/1682004/3/sbsdk.txt]Spaceball Protocol[/url]

[url=http://paulbourke.net/dataformats/spacemouse/]Magellan/SpaceMouse Protocol[/url]
[color=#BF0000][b][url=http://spacemice.org/]Spacemice[/url] -- Input Devices for a 3D World[/b][/color]


Return to “General Hardware”

Who is online

Users browsing this forum: No registered users and 12 guests