digistump / DigistumpArduino

Files to add Digistump support (Digispark, Pro, DigiX) to Arduino 1.6.X (1.6.5+)
932 stars 377 forks source link

Timer0 interrupt driven timer has unstable and erratic timing #155

Open LightningStalker opened 2 years ago

LightningStalker commented 2 years ago

The following code does not function as expected: https://gist.github.com/LightningStalker/ecaf6b26f6c48334a6190d6a4ce945c1

Oscilloscope probing shows pin transition points to be unstable. Simulating the above code in MPLAB X IDE confirms this. Something in the core is causing the interrupt vector routine to fire in a several µs window around the expected time. Trying a different Attiny core makes it mostly disappear. I say mostly because there is still something causing spurrious timing errors in that core as well. Also I am unable to flash the Digispark with that code.