Fri 18 Sep 2015 10:24:35 AM UTC, original submission:
@mhx detected and fixed a problem with CLIs near interrupts and also provided a patch. Thank you, @mhx.
Then a different patch was applied to fix the same issue. Since then timer interrupts, at least timer 1A, have become unreliable.
The code exposing this misbehaviour is Teacup Firmware. It runs fine on real hardware, it runs fine in simulations before the patch and it also works fine with @mhx' patch applied. For illustration I've attached screenshots of runs with all three versions of SimulAVR.
Explanation of the screenshots:
- Row 'X_step' is the raw pin signal, like delivered by SimulAVR.
- Row 'X_steps/s' is the inverse time distance ( = step rate) between raising flanges on this pin signal. It's calculated with a postprocessor.
- All the rows below these two don't matter.
- Usual distance between two steps at maximum step rate is 113.8 ms.
- Long step distances, seen only in the "Savannah patch" versions, are a constant 4176.9 ms.
- It's a simulated ATmega644 running at 16 MHz or 62 ns/tick, timer A is running at full clock speed, no divider.
- Pocket calculator says that (4167900 - 113800) / 62 = 65388 ~= 65536 = 2^16, so it looks much like the timer interrupt doesn't happen in time, but only after the scheduled time plus a full timer overflow round.
|