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

 
 

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

Submitted by:  Markus Hitter <hitterm>
Submitted on:  Fri 18 Sep 2015 10:24:35 AM UTC  
 
Category: SimulationSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Klaus Rudolph <zfrdh>
Open/Closed: ClosedComponent Version: simulavr

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
Fri 18 Sep 2015 10:26:01 AM UTC, comment #1:

See also https://github.com/Traumflug/simulavr/issues/10

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 File(s):
   
   
Comment:
   

Attached Files
file #34916:  unpatched.png added by hitterm (66KiB - image/png - Screenshots of runs with various SimulAVR versions.)
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.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 26 Oct 2015 10:56:31 PM UTCzfrdhOpen/ClosedOpen=>Closed
    Mon 26 Oct 2015 10:56:10 PM UTCzfrdhStatusNeed Info=>Fixed
    Mon 05 Oct 2015 01:54:20 PM UTCzfrdhStatusNone=>Need Info
      Assigned toNone=>zfrdh
    Fri 18 Sep 2015 10:24:35 AM UTChittermAttached 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.1-cleanup1