Hi,
I’ve been wrestling with the digital pin behavior on an E310 and am wondering if anyone can help. I am running the latest firmware with threading disabled.
I have three pins (D1, D2, D4) configured as INPUT_PULLDOWN in setup(), and have found that they go high briefly on startup, when receiving application updates via cellular, and after sending a particle.publish. This is problematic because I need to be able to rely on getting accurate input from these pins.
I was able to work around the startup and publish behavior by adding delays at the end of setup and after each publish event respectively though this is less than ideal, and I have been unable to find a workaround for the update behavior because I can’t find any way to determine it is happening (event, syscall, etc) before the pins go high.
So I have two questions - first, is all of this behavior expected and unavoidable? Second, if so, is there a way to identify when an update is coming in so I can ignore the pins pre-emptively? I have tried event handlers, checking for OTA updates, but the pins always go high before the event registers and I can react to it.
Thanks!
Do you happen to have longish wires connected to these pins?
Are you sure it’s the pins going high and not receiving a high level from outside (e.g. induced voltage)?
Can you try stronger external pull-downs?
You can also try to set the pinMode()
in the STARTUP()
macro to get ahead of the system trying to establish the cloud connection in AUTOMATIC
mode.
Thanks for your reply!
I’m pretty confident the connected sensors aren’t triggering and that it’s the pins going high on their own; the behavior is consistently reproduced when there’s no sensor input.
Of the three inputs, one set of wires is probably 5cm, another is 15cm and the third is probably 60cm. I’m traveling and don’t have any pulldowns with me but will give that a try when I can…any recommendations on strength? (My background is CS rather than EE so apologies for my ignorance.)
I did resolve my second question - I was just watching for the wrong event (reset instead of firmware_update). So now I have workarounds for all of the issues, but it would be preferable to avoid using delays and get consistent behavior.
That depends on what kind of sensor you got connected to these pins, but I'd think 4k7 or 2k2 should work in most cases.
The reason for suspecting EM induced signals comes from this
This suggests considerable data traffic and the power from the antenna signal may well be picked up by the leads - especially if you have them close to the antenna.
1 Like
That seems probable…I’ll give it a try. Thank you!