bugSimulavr: an AVR simulator - Bugs: bug #45994, Patch applied with #45941 breaks...

 
 

bug #45994: Patch applied with #45941 breaks timer interrupts

Submitter:  Markus Hitter <hitterm>
Submitted:  Fri 18 Sep 2015 10:24:35 AM UTC
   
 
Category:  Simulation Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  zfrdh
Open/Closed:  Closed Component Version:  * simulavr
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 26 Oct 2015 11:03:06 PM UTC, comment #3: 

I added a new testfile tc5.cpp for gtest

As I see the hardware device behaves now as the simulator if the last instruction before the irq starts did not generate a irq itself. This is still not fixed because it needs better simulation of pipelining.

Because I have no png debugger I could not check if the in this record reported problem is also fixed... If not: Feel free to reopen again but please provide some useful information ( source file and/or trace output ) Thanks!

Klaus Rudolph <zfrdh>
Group administrator
Mon 05 Oct 2015 01:54:20 PM UTC, comment #2: 

Thanks for the report.

Please send a little asm or c example which shows the problem. I can't catch the underlying problem actually. Maybe you can describe which timer (1A?) runs in which mode? For my understanding it should be possible to reduce the problem to small example. But you write "Now I'm wondering how I can simplify this complex firmware into a demonstration case which can be measured on the scope". So I am wondering how to reproduce the problem if the failure couldn't be reproduced with a simple example.

For me it is not necessary to get gtkwave outputs. A trace file with good/fail case would be more interesting for me.

Thanks!

Klaus Rudolph <zfrdh>
Group administrator
Fri 18 Sep 2015 10:26:01 AM UTC, comment #1: 
Markus Hitter <hitterm>
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.

Markus Hitter <hitterm>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #34917:  mhx patch.png added by hitterm (66KiB - image/png - Screenshots of runs with various SimulAVR versions.)
file #34918:  Savannah patch.png added by hitterm (69KiB - image/png - Screenshots of runs with various SimulAVR versions.)
file #34919:  Savannah patch zoomed.png added by hitterm (71KiB - image/png - Screenshots of runs with various SimulAVR versions.)
file #34916:  unpatched.png added by hitterm (66KiB - image/png - Screenshots of runs with various SimulAVR versions.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by zfrdh (Posted a comment)
  • -email is unavailable- added by hitterm (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-10-26 zfrdh Open/ClosedOpen Closed
    2015-10-26 zfrdh StatusNeed Info Fixed
    2015-10-05 zfrdh StatusNone Need Info
        Assigned toNone zfrdh
    2015-09-18 hitterm Attached File- Added unpatched.png, #34916
        Attached File- Added mhx patch.png, #34917
        Attached File- Added Savannah patch.png, #34918
        Attached File- Added Savannah patch zoomed.png, #34919

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code