Trackball Serial Communication
Started by Luke Z, Aug 20 2012 06:35 PM
7 replies to this topic
#1
Posted 20 August 2012 - 06:35 PM
Ok, so I have a 5byte serial trackball attached through a level converter to my netduino on port 2. The trackball is hard wired for 1200 baud. I seem to be getting dropped bits. For example
Hyperterminal on my pc shows:
Left click: 131 -> 10000011
Right click: 134 -> 10000110
Debug output from the netduino shows:
Left click: 62 -> 111110
Right click: 158 -> 10011110
Is 1200 baud too slow? Do I have messy edges on my serial and need to pull them up or down?
Help!
#2
Posted 21 August 2012 - 01:48 PM
Went through something similar a while back - was getting predictable, repeatable but wrong values back. My issue was not having the correct level shifter - what are you using?
- Paul Newton likes this
#3
Posted 21 August 2012 - 04:31 PM
just a guess - it looks like the data may be inverted.
What does 5byte refer to?
#4
Posted 21 August 2012 - 05:13 PM
Went through something similar a while back - was getting predictable, repeatable but wrong values back. My issue was not having the correct level shifter - what are you using?
I'm using this level shifter:
https://www.sparkfun.com/products/8745
This is what I mean by 5byte:
http://www.kryslix.com/nsfaq/Q.12.html
The 5 byte Mouse Systems packet section.
#5
Posted 21 August 2012 - 05:40 PM
How exactly do you have the trackball connected to your PC? Is it connected directly to serial (RS-232) port or do you use any converter?
Because if it is connected directly, it has RS-232 levels and you'd need RS-232 <-> 3.3V converter for Netduino (i.e. MAX322x), I don't think Sparkfun's logic level converter (5V <-> 3.3V) works correctly for RS-232 (~ ±10 V).
#6
Posted 21 August 2012 - 07:02 PM
I agree with CW2 and 65tux, the level shifter you have is for +5V to +3.3V conversion. Not RS232 to 3.3V conversion.
What you need is +5V to 0V and -5V to +3.3V
e.g. the signal is inverted and the voltage limited.
If you only need one way comms (from the trackerball to the Netduino), then you can use a transistor to do the job. Otherwise one of the max232 family will be needed.
Have fun - Paul
#7
Posted 21 August 2012 - 11:56 PM
Thanks to all, I see what you are all getting at and that makes perfect sence.
I have ordered a couple of these, http://www.robotshop...-adapter-5.html
I hope these will fix the issue. I will report back with more.
#8
Posted 29 August 2012 - 02:36 PM
Looks like those 232 to TTL converters I mentioned are working perfectly. only using one pin, but it works well. Thanks for everyones help.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users