Glitch found on Interrupt pin
Topic: Glitch found on Interrupt pin
(Read 468 times)
Glitch found on Interrupt pin
Feb 10, 2016, 07:03 pm
This is my first Arduino project and my first attempt at "C" coding so go gentle with me.
My motor-home GPS does not display Course or Altitude without going pretty deep into the menu system. When I looked for a simple device to display these data I couldn't find a GPS unit that did both only specifically the Altitude in feet. A OBDII unit isn't an option because the Motorhome is a diesel and doesn't have an OBDII system. I couldn't replace the GPS because it's integrated into my in dash Sony Receiver and besides I like the Navigation functions it offers. I was looking for a project to do with a Teensy 3.2 and this seemed to fill the bill. My original plan was to use the Touch Panel on the 3.2" TFT to change the Back Light Levels but the enclosure I found had a plastic cover over the screen so I connected a Momentary switch to one of the digital pins to change the Back Light PWM pin.
I soon discovered when left completely alone the back light changed on it's own. Not very often and quite randomly. SO I began the Glitch Study in the attached zip file. It became apparent the Interrupt routine was being entered without touching the switch. The first thing I tried was to turn off the internal pull-up and install an external 10K pull-up to 5 Volts. The Teensy 3.2 is 5 Volt tolerant and the internal pull-up was connected to 3.2 Volts. Not much change. It happened less often but still happened.
Finding the problem:
So I broke out the Logic Analyser and "O" scope to see if I could characterize the cause. The logic analyzer shaped the signal into a square wave so I could at least see what the Teensy was seeing. I have put some screen shots in the directory "Test Sample Pictures" of both internal and external pull-ups. These Glitches are very short, between 40 and 100 Nsec. The scope showed them to be a ringing coming through the 5 Volt rail presumably static. The interconnect board I had made did not have a ground plane and I don't know if the Teensy does or not. You can find the schematic and PWB layout in the directory "Breakout Interface Design Doc's". I included the free Express PCB software used to design it and order the boards. The directory "Test Configuration" has pictures of the breadboard hardware, and the directory "RV_GPS_3_Software" has the Arduino files and required Libraries for the project. In the source any line with "***" in the comment is a test line and will not be in the final code.
Long term I will be sure to include a health ground plane in any future PWB's I have made. Short term I have added Glitch detection in the Interrupt routine at the very end of the source code. This detector costs 25 Msec in the routine which in my application isn't a show stopper since GPS data is a slow process anyway. All the de-bounce code is in the main line to avoid having interrupts off for long periods of time. This solution works well for me and I thought you guys may be interested and perhaps even comment on ways it could be avoided or improved.
Thanks for looking!
Dick Berry in Albuquerque
p.s. I couldn't get the zip file to upload, perhaps it's too big, so you can find it here http://1drv.ms/1PNQ9Iq on my One-Drive