Very Strange Behavior with Propstick
GeofPrice
Posts: 16
Dear Smarter People Than Me:
I have a very strange problem with a Propstick. I have the Propstick connected to a Linx Technologies LICAL-DEC-MS001-ND which is a decoder for a radio control device. This decoder is connected to a receiver and the receiver is controlled by a key fob like you use to open the doors on your car. The decoder decodes which button on the key fob has been pressed, and raises a particular line high based upon that code. I have two of those lines, corresponding to two different buttons on the key fob, connected to P30 and P31 on the Propstick. All of the decoder and receiver electronics are powered from the 3.3 v output of the Propstick. All of the decoder/receiver works properly as long as the outputs of the decoder are not connected to the IO pins of the Propstick.
Now, the first problem. When I connect P31 to the decoder, the Propstick will no longer load a program from the USB port using the Propeller Tool. The decoder simply puts out either 0v or 3.3v so P31 should handle this perfectly. I get an error that no Propstick is found when I try to load a program or check for communications. This in itself drove me crazy for a while because I could not get the Propstick to accept a program. I finally disconnected everything except the +5v power from the Propstick, got it to communicate and load a program, then started reconnecting stuff until it quit communicating, and that was when I connected P31 to the decoder. I have tested this several times. With P31 connected to the decoder, USB communications fail. Disconnected, the Propstick communicates and loads a program. Please note that is NOT the case for P30 and a connection to one of the other lines of the decoder. I can connect P30 and the Propstick still communicates and loads my program.
Now the plot thickens. I decided to leave P31 disconnected for the time being while I debugged my program, then I thought I would try some other input lines and see if I could get everything working. So I load a program and immediately start seeing some very strange behavior. P30 would only change voltage from 3.3 to 2.5 volts when I sent a signal to the decoder through the receiver/key fob. This looks like the Propstick is trying to hold the line high while the decoder is toggling - but P30 is set to be an input - why would it be trying to hold high?. But I thought I had just checked it was working, and sure enough, if I reset the Propstick, P30 will toggle properly from the decoder AS LONG AS I DON'T load a program; i.e., if I don't load a program into RAM (the EPROM would have DoNothing.spin loaded), I can toggle P30 from 0v to 3.3 v and back again by pressing the proper key on the key fob.
So I decide that I must have something really crazy in my program - maybe a buffer overflowing somewhere or something, so I trim it down to the smallest thing I can. I just read P30 and write it back to P31:
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
RadioControlPin1 = 31
RadioControlPin2 = 30
VAR
long i
PUB Main
repeat
-dira[RadioControlPin2] := 0
-i := ina[RadioControlPin2]
-dira[RadioControlPin1] := 1
-outa[RadioControlPin1] := i
This works perfectly. I can see both P31 and P30 toggle from 0v to 3.3v and back again as I press the appropriate key on the key fob. Next, I start adding in code to see if I can find the point at which things fail. Sure enough, this fails:
OBJ
pst : "Parallax Serial Terminal"
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
RadioControlPin1 = 31
RadioControlPin2 = 30
VAR
long i
PUB Main
pst.Start(115_200) ' Start Parallax Serial Terminal object.
repeat
-dira[RadioControlPin2] := 0
-i := ina[RadioControlPin2]
-dira[RadioControlPin1] := 1
-outa[RadioControlPin1] := i
Now when I press the key on the key fob toggling the decoder line which is connected to P30, P30 only changes from 3.3v to 2.5v and P31 stays high all the time (since P30 stays above 1.6 v all the time). Starting up the Parallax Serial Terminal messes everything up.
Can anyone help me here? Why would a connection to the LICAL-DEC-MS001-ND output lines mess up USB communications between the Propstick and the computer? Even more troubling, what in the heck is going on when starting the Parallax Serial Terminal messes up the program? I will put dollars to donuts the two problems are related.
I have a very strange problem with a Propstick. I have the Propstick connected to a Linx Technologies LICAL-DEC-MS001-ND which is a decoder for a radio control device. This decoder is connected to a receiver and the receiver is controlled by a key fob like you use to open the doors on your car. The decoder decodes which button on the key fob has been pressed, and raises a particular line high based upon that code. I have two of those lines, corresponding to two different buttons on the key fob, connected to P30 and P31 on the Propstick. All of the decoder and receiver electronics are powered from the 3.3 v output of the Propstick. All of the decoder/receiver works properly as long as the outputs of the decoder are not connected to the IO pins of the Propstick.
Now, the first problem. When I connect P31 to the decoder, the Propstick will no longer load a program from the USB port using the Propeller Tool. The decoder simply puts out either 0v or 3.3v so P31 should handle this perfectly. I get an error that no Propstick is found when I try to load a program or check for communications. This in itself drove me crazy for a while because I could not get the Propstick to accept a program. I finally disconnected everything except the +5v power from the Propstick, got it to communicate and load a program, then started reconnecting stuff until it quit communicating, and that was when I connected P31 to the decoder. I have tested this several times. With P31 connected to the decoder, USB communications fail. Disconnected, the Propstick communicates and loads a program. Please note that is NOT the case for P30 and a connection to one of the other lines of the decoder. I can connect P30 and the Propstick still communicates and loads my program.
Now the plot thickens. I decided to leave P31 disconnected for the time being while I debugged my program, then I thought I would try some other input lines and see if I could get everything working. So I load a program and immediately start seeing some very strange behavior. P30 would only change voltage from 3.3 to 2.5 volts when I sent a signal to the decoder through the receiver/key fob. This looks like the Propstick is trying to hold the line high while the decoder is toggling - but P30 is set to be an input - why would it be trying to hold high?. But I thought I had just checked it was working, and sure enough, if I reset the Propstick, P30 will toggle properly from the decoder AS LONG AS I DON'T load a program; i.e., if I don't load a program into RAM (the EPROM would have DoNothing.spin loaded), I can toggle P30 from 0v to 3.3 v and back again by pressing the proper key on the key fob.
So I decide that I must have something really crazy in my program - maybe a buffer overflowing somewhere or something, so I trim it down to the smallest thing I can. I just read P30 and write it back to P31:
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
RadioControlPin1 = 31
RadioControlPin2 = 30
VAR
long i
PUB Main
repeat
-dira[RadioControlPin2] := 0
-i := ina[RadioControlPin2]
-dira[RadioControlPin1] := 1
-outa[RadioControlPin1] := i
This works perfectly. I can see both P31 and P30 toggle from 0v to 3.3v and back again as I press the appropriate key on the key fob. Next, I start adding in code to see if I can find the point at which things fail. Sure enough, this fails:
OBJ
pst : "Parallax Serial Terminal"
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
RadioControlPin1 = 31
RadioControlPin2 = 30
VAR
long i
PUB Main
pst.Start(115_200) ' Start Parallax Serial Terminal object.
repeat
-dira[RadioControlPin2] := 0
-i := ina[RadioControlPin2]
-dira[RadioControlPin1] := 1
-outa[RadioControlPin1] := i
Now when I press the key on the key fob toggling the decoder line which is connected to P30, P30 only changes from 3.3v to 2.5v and P31 stays high all the time (since P30 stays above 1.6 v all the time). Starting up the Parallax Serial Terminal messes everything up.
Can anyone help me here? Why would a connection to the LICAL-DEC-MS001-ND output lines mess up USB communications between the Propstick and the computer? Even more troubling, what in the heck is going on when starting the Parallax Serial Terminal messes up the program? I will put dollars to donuts the two problems are related.
Comments