Go Down

Topic: Understanding RS232 data... (Read 2 times) previous topic - next topic

luxeomni

OK massive noob here,
i ve got a rs232 adr device ( it's a tablet, not wacom but same kind ). i know its 19200 8n1 and i want to reverse engineering it by trying to understand the protocol of this thing. I ve manage to monitor the com port with realterm, and now i ve got a bunch of hex numbers/data corresponding to the activity of the tablet ( i guess stuff like : is the sylus on or hovering ? and x and y position of the stylus ). The problem is... i just don't know what to do, how to read, or how even to understand those HEX values. Ive tried to translate them to decimal values but...i don't even know what kind of protocol/pattern i have to see.
I don't expect a miracle answer but just if someone can show me a learning path ( book, tutorials, anything), to at least understanding what is going on with this data, and at the end of the road, writing sketches to interfacing with those data.

Thanks for any inputs.

Coding Badly

Quote
it's a tablet, not wacom but same kind


Disclose the identity.

luxeomni

It's a topaz signature tablet t-w751.


Graynomad

If you can't find the protocol definition (have you Goolged for it?) then you have to figure it out yourself.

It sounds like you have already made a good start, now you need to try and isolate the bytes that are sent as a result of various events.

For example watch the line until nothing is happening, then touch the upper left of the screen. Did a burst of data appear?  Touch the lower right and record the burst from that. Then look at the two lots of data and try to figure out the format. In this example you would expect maybe four bytes to hold the X and Y locations, they should be easy to see.

Hopefully every event produces the same basic format, just with different data. If so you should be able to start deciphering the contents of the data  "packets".

The line may not go idle between events, there may be other stuff going on all the time like a query to see if anything is there. As long as what's happening is stable and repeatable you can still differentiate between that and event data.

Can you post a few examples of the data?

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

luxeomni

I m trying to see patern, but sometime i found some, do a test to see if it consistent and then the pattern iw completly different.
Like in the second exemple, i can see 7C a lot and then it desapears...

This is some data when i hover above the tablet with the stylus  on diverse area:

C0 35 F9 FC 7C C0 35 F9 26 F9 4A 34 F9 59 F9 C0 9C 94 DA 00 40 9D 4C DA
00 40 47 A4 B4 00 4A 89 7C 69 7B C0 CD C7 26 00 C0 CD C7 26 00 C0 CD C7
26 00 C0 CD C7 26 00 C0 C5 C7 12 FC 4A 37 3B 67 FC 40 23 7E CA 00 C0 46
6E 94 00 40 13 62 94 00 C0 11 5E 94 00 C0 35 FC 8D 3E 4A 98 66 CA 00 40
11 84 9C 00 C0 26 CC 9C 00 C0 30 78 D1 1E C0 9F 4F 15 1E 40 C7 CF 71 00
40 C7 CF 9B 1E 40 8E CF 73 00 40 1C CF 17 1E 40 8E 4F E6 00 4A 10 78 48
1E C0 CE 47 8A 00 C0 39 3B D1 FC C0 9E 3B CF FC CA 89 47 13 FC

And this is when i press on it and draw :

87 2F 7C 70 1E 87 33 22 CE 00 87 33 3E 9C 00 87 33 52 9C 00 87 33 6E 9C
00 87 33 8A 9C 00 87 33 AA CE 00 87 33 CA CE 00 87 33 EE CE 00 87 5F 7C
41 FA 87 DE 7C C5 FA 87 5C 7C 64 FA 87 5A 7C CC FA 87 D8 7C 50 FA 87 56
7C 9A 1F 87 2A 7C 45 1F 87 29 7C 5C FA 87 68 7C 93 00 87 67 7C 63 FA 87
26 7C 73 FA 87 25 7C 3A FA 87 64 7C ED FA 87 C5 7C F0 FA 87 30 7C F3 FA
87 7E 78 1D FA 87 3D 78 78 FA 87 77 78 3D FA 87 8E D4 A4 00 87 27 FC A4
00 87 8D 24 AC 00 87 E7 78 62 3D 87 63 78 23 3D 87 5F 78 64 3D 87 5A 78
CA 3D 87 35 78 25 3D 87 D1 78 25 3D 87 CC 78 25 3D 87 23 78 25 3D 87 30
78 25 3D 87 7D CF 89 3D 87 78 CF 89 3D 87 8E 4F 99 3D 87 E7 4F 32 3D 87
EB 4F 62 0F 87 73 4F CC 0F 87 63 4F C4 0F 87 F3 4F 88 3D 87 5C 4F D6 00
87 36 4F A4 00 87 D7 CF 8F 1F 87 2A 4F 47 1F 87 29 CF 8E 1F 87 68 4F D2
00 87 67 CF 27 1F 87 33 4F 1A FA 87 4D 4F 19 FA 87 4D CF 18 FA 87 4D 4F
93 00 87 4E 4F 8B 1F 87 50 CF 35 FA 87 D2 4F 34 FA 87 9A CF 33 FA 87 35
CF 12 FA 87 C5 4F 4C 1F 87 36 4F 98 1F 87 5C CF 9C 00 87 60 4F CE 00 87
32 CF CE 00 87 69 CF 1D 1E 87 1B 4F 9E 1E 87 72 4F CE 00 C0 CF 4F 3B 1E
40 C2 A4 9C 00 40 99 6C CE 00 C0 4D 3C CE 00 40 4E 14 CE 00 40 8E F4 71
00 40 84 DC 71 00 40 99 7C DD 1E CA 9E 7C DD 1E

thanks for helping

luxeomni

For the protocol the only thing i know is that the tablet has a 5 bytes impulse train, 1 status bytes : 176 tablet on but no stylus detected, 240 stylus detected and hovering and 241 stylus detected and writing on the tablet and then 4 position bytes : subcol (0-127), col(4-22), sub row (0-127) and row (4-17). for exemple 241,63,13,63,10 means that the sylus is pressed at the center of the tablet.

But.... when i try to translate the HEX values i ve got from Realterm to decimal, i never see numbers like 176 240 and 241...that's why it gives me a little headache.

robtillaart


Try to see patterns. - I don't know how you hovered so it is just the patterns I see

observations:
- The C0 looks like a separator/start/stop character. (see above)
- packet lengths seem to be multiples of 5
- The first byte has only 4 values = { 40, 4A, C0, CA } => looks like a command

Write a program that reads 5 bytes and merges byte1,2 to an int and byte 3,4 to an int; something like :

command = readbyte();
int col = readbyte() * 256 + readbyte();    // or readbyte() + 256 * readbyte();  depends on LOW HIGH byte order
int row = readbyte() *256 + readbyte();
print command, row, col

You must be able to get a 0,0 coordinate at one of the corners or in the middle of the tablet.

If you get the coordinates right things will be simpler.



The second part has same pattern, command 87 which probably means "draw" followed by X,Y coordinates.
Code: [Select]

87 2F 7C 70 1E
87 33 22 CE 00
87 33 3E 9C 00
87 33 52 9C 00
87 33 6E 9C 00
87 33 8A 9C 00
87 33 AA CE 00
87 33 CA CE 00
etc

Draw distinct lines horizontal vertical diagonal and look for patterns.

succes,
Rob
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Graynomad

#7
Aug 05, 2011, 05:57 pm Last Edit: Aug 05, 2011, 06:10 pm by Graynomad Reason: 1
Here's one possibility
Code: [Select]
C0 35 F9 FC 7C
C0 35 F9 26 F9 4A 34 F9 59 F9
C0 9C 94 DA 00 40 9D 4C DA 00 40 47 A4 B4 00 4A 89 7C 69 7B
C0 CD C7 26 00
C0 CD C7 26 00
C0 CD C7 26 00
C0 CD C7 26 00
C0 C5 C7 12 FC 4A 37 3B 67 FC 40 23 7E CA 00
C0 46 6E 94 00 40 13 62 94 00
C0 11 5E 94 00
C0 35 FC 8D 3E 4A 98 66 CA 00 40 11 84 9C 00
C0 26 CC 9C 00
C0 30 78 D1 1E
C0 9F 4F 15 1E 40
C7 CF 71 00 40
C7 CF 9B 1E 40 8E
CF 73 00 40 1C
CF 17 1E 40 8E 4F E6 00 4A 10 78 48 1E
C0 CE 47 8A 00
C0 39 3B D1 FC
C0 9E 3B CF FC
CA 89 47 13 FC


Not sure about the C7/CF/CA but maybe Cx is a command of some kind.

Keep it simple. No hovering in "diverse areas", or mucking around, one touch top left, one touch bottom right or something like that.

_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Graynomad

#8
Aug 05, 2011, 06:16 pm Last Edit: Aug 05, 2011, 06:25 pm by Graynomad Reason: 1
Another thing, are you sure you're synchronized with the data stream?

Is there a break in the data so the terminal prog can get in step?

Put another way, if you don't do anything do you still get data?

That could explain why this happens

Quote
i can see 7C a lot and then it desapears...


and also why the above patterns don't seem to have the same delimiters. Your data could be shifted by different amounts each time you look at it.


_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Coding Badly

Quote
i know its 19200 8n1


How do you know?

From the Topaz website, they seem to favour...

Quote
Bits per second: 19200
   Data bits: 8
   Parity: Odd
   Stop bits: 1
   Flow control: Doesn't matter...leave default value

cr0sh

Something else to do, if you haven't done so already - is to contact the manufacturer, by phone if necessary. Be polite about your request, and give exact information (model number and such). You may get something, you may not. Tell them you are working on a driver for the PC (or maybe the Mac), and need some help. Ask them if there are any original testing utilities or drivers available as well as any documentation on the protocol. The first person you talk to may not have any clue what you need, just be polite, and try to escalate the call to better technical service (if you're lucky, you'll get transferred to some form of "engineering" department).

Another thing to look into is if there are any open-source drivers (for Linux, perhaps) available; check around the GIMP project and similar for tablet drivers and such - you might also look into archives of the vintage for drivers and the like (for example, if the tablet is old enough for DOS, look around in the multitude of DOS archives for drivers and/or test utilities).

Good luck!
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

luxeomni

#11
Aug 05, 2011, 08:14 pm Last Edit: Aug 05, 2011, 08:57 pm by luxeomni Reason: 1
Coding Bradly : For the "parity odd or none" thing someone who played with the tablet but is now unreachable told me that it was "non", anyway i tried with the parity set to "odd" and heres the result of a basic test :

87 70 3F 55 7E draw top left
87 8B 1D 7D 77 draw bottom right

When i hove the 5 bytes section are begining by C0, 40 or CA, mainly C0 and 40 alternating.

Graynomad : i absolutly don't know if the data stream is synchronised as i said 'Massive noob". But as you ask, no i don't have any data coming till i m approaching the pen, i m using a teensy loaded with usb serial prog for interfacing with my pc. I ve only connected the send data from the tablet to the pc, so i can only monitor data sent by the tablet.

cr0sh : in fact there is a lot of ressource and tools from Topaz Website, but as i said in my first post, i m a massive noob, and when i start to read stuff from the topaz site i understand close to nothing, but as i said, i m just trying to find a way to understand it with a learning curve.

And you all already show me some lights :)

Go Up