This is using an attiny861a but I don't think it's limited to this model.
It has, a.o, three ports used for counting two of them on port A, which have no problems whatsoever. The third, on port B, is "strange", it's on pin 9, between the crystal (7/8) and reset (10) (maybe that matters).
All of the inputs have their PCINT enbled and working. The weirdness begins when I connect a 3 ft coaxial cable to the strange input (pin 9). Whenever the cable is shortened (which should give an interrupt), the controller resets.
The reset only happens when the 3 ft cable is used AND a debouncing cap is used (100 nF). If the pins are shorted directly OR the cap is left out, it works as designed.
The others ports on "A" work fine, with debouncing cap and 3 ft cable.
These are the possible (but ineffective) solutions I've tried:
- disable PCINT altogether, controller still crashes, so apparently it's not a software bug
- use smaller caps, didn't help
- use clamping with two 1N4148 diodes
- use 5V1 zener
None of this helps.
I guess I am creating some sort of RC-circuit with the cable and the capacitor and the input voltage rises above Vcc? But why don't the other ports suffer from this?
The controller gets it's Vcc from USB, which is stabilised using an elco, a 5V1 zener and two 100 nF caps (Vcc and AVcc).
I am totally puzzled...