Reliably detect if a pin is high or low if it might be floating?
ke4pjw
Posts: 1,155
in Propeller 1
Is there are way to reliably detect if a pin is high or low if it is possibly floating on the P1? I made a mistake on a board layout years ago by not including a pulldown on an optional accessory output, and now want to detect if an accessory board is installed. I have not tested if just placing a pullup would work, but I am not sure if it would work reliably. I suspect with it is floating, it may false positive as "high".
Comments
Probably worth modifying all existing boards.
Software only solution will struggle. It maybe to measure an R-C charge curve, depending on how long the tracks are. Would need to know a lot more about the circuit.
Thanks for your thought @evanh. I am just using the pin to detect if a module is plugged via pull-up. The module (a ESP8266) can be interrogated via serial, so I think I will go that route, as the option plug has the extra pics for serial. If the detect pin is high, interrogate the module, and if detected, enable the features for that module. I like the idea of measuring the RC curve, though.
This is for AC dimming light controllers I designed over a decade ago. I have a handful out in the wild used by friends and others. I am adding the ESP8266 board so they can use E1.31 (DMX over IP) so they can be wireless.
I have a whole stack of unpopulated boards and basically, WS2811 LEDs have made them obsolete, LOL. I still use 13 or so in my Christmas display, but they are all eventually going to be replaced with my P2 boards and WS2811 LEDs.
Pulse the pin high, then let it float. Does it stay high? Pulse it low, then let it float. Does it stay low? If the answer to both questions is yes, then the pin is floating.
-Phil
Oh, do the serial interrogation option. That's a way better solution, IMHO.
@"Phil Pilgrim (PhiPi)" Thanks Phil. I am going to do this until I get my hands on actual hardware. I have a friend that is actually designing the daughter board. I have all of my DMX boards packed away for summer and am sending him code to try
Found this SPIN function in some old test code:
No idea about the original author, but seem to recall it coming from the forums many moons ago.