mDelay Error

  • 1
  • 2
  • 3
  • Page 1 of 3
TheBeginner
Schreiberling
Avatar
Gender: n/a
Location: Wunsiedel Bayern
Age: 67
Posts: 756
Registered: 06 / 2013
Subject:

mDelay Error

 · 
Posted: 27.03.2022 - 12:05  ·  #1
Hello Merlin, something is wrong with mDelay.
If I hit the hammer (Make Project), mDelay has no effect.
I press Make and Optimize I have 2 sec wait time.
I tested it 20 times.

Hallo Merlin, mit mDelay stimmt was nicht.
drücke ich den Hammer (Make Project) hat mDelay keine wirkung.
drücke ich Make und Optimize habe ich 2 sec warte zeit.
ich habe es 20 mal getestet.


Code

      if bool = true then
        bool:= false;
        write(SerOutCDC, 'ok');

        mDelay(2000);   //<==============
      endif;



Gruß Frank
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1374
Registered: 03 / 2005
Subject:

Re: mDelay Error

 · 
Posted: 27.03.2022 - 13:29  ·  #2
Which processor, Frank?

Can you send me your project so I can check other possibilities?

Thanks

======================================================

Welcher Prozessor, Frank?

Können Sie mir Ihr Projekt schicken, damit ich andere Möglichkeiten prüfen kann?

Danke
TheBeginner
Schreiberling
Avatar
Gender: n/a
Location: Wunsiedel Bayern
Age: 67
Posts: 756
Registered: 06 / 2013
Subject:

Re: mDelay Error

 · 
Posted: 27.03.2022 - 16:02  ·  #3
Hello Merlin, yes I can do that.
XMega256A3U with the latest version that is on the server



Hallo Merlin, ja kann ich machen.
XMega256A3U mit der neuesten Version die auf dem Server liegt



Gruß Frank
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1374
Registered: 03 / 2005
Subject:

Re: mDelay Error

 · 
Posted: 27.03.2022 - 17:38  ·  #4
Danke, Frank.
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1374
Registered: 03 / 2005
Subject:

Re: mDelay Error

 · 
Posted: 27.03.2022 - 21:20  ·  #5
Hello Frank.

Your problem is not with mDelay, at least not directly. Taken alone, Optimized and unoptimized will work identically. Furthermore, mDelay certainly does not 'do nothing' either optimized or unoptimized. BUT your interrupts are not properly protected, and _ACCDxx which is used by mdelay is corrupted inside the interrupts. The optimizer defends against that corruption, which is why mDelay(2000) (which is two seconds) works with the optimizer.

Regards

========================================================================

Hallo Frank.

Dein Problem ist nicht an mDelay liegt, zumindest nicht direkt. Für sich genommen funktionieren Optimized und unoptimized identisch. Außerdem macht mDelay weder optimiert noch unoptimiert "nichts". ABER Ihre Interrupts sind nicht richtig geschützt, und _ACCDxx, das von mdelay verwendet wird, ist innerhalb der Interrupts beschädigt. Der Optimierer schützt vor dieser Beschädigung, weshalb mDelay(2000) (das zwei Sekunden ist) mit dem Optimierer funktioniert.

Mit freundlichen Grüßen


Übersetzt mit www.DeepL.com/Translator (kostenlose Version)

Merlin
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1374
Registered: 03 / 2005
Subject:

Re: mDelay Error

 · 
Posted: 27.03.2022 - 21:29  ·  #6
PS

The interrupts are defined in the unit "uXmega_CDC" which may be a PCU. It certainly wasn't in the list of files you sent me. PCU files are not part of the compiler, and I do not know who wrote this one, so your only solution is to use the optimizer, I am afraid.

=======================================================================

PS

Die Interrupts sind in der Einheit "uXmega_CDC" definiert, die eine PCU sein könnte. Sie war jedenfalls nicht in der Liste der Dateien enthalten, die Sie mir geschickt haben. PCU-Dateien sind nicht Teil des Compilers, und ich weiß nicht, wer diese geschrieben hat, also bleibt Ihnen leider nur die Verwendung des Optimierers.


Merlin
miparo
Administrator
Avatar
Gender:
Location: Germany
Age: 59
Posts: 957
Registered: 09 / 2007
Subject:

Re: mDelay Error

 · 
Posted: 27.03.2022 - 21:45  ·  #7
Hi Merlin,
the uXmega_CDC unit comes from me.
In which interrupt is ACCDxx destroyed ?

miparo

Edit:
I just see that _ACCDxx is never used directly by the driver

The only places are in uXmega_CDC._CDCRXDATA and _CDCTXDATA.
But these are implemented directly in Rolf's AVRco.

Used in write(SerOutCDC, 'ok'); called from uXmega_CDC._USB_Task direcly in AVRco ?
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1374
Registered: 03 / 2005
Subject:

Re: mDelay Error

 · 
Posted: 27.03.2022 - 22:49  ·  #8
To be honest, miparo, I haven't analysed deeply, but I do know that the optimiser scans for which registers are used and saves them, and that these registers are saved.

The interrupts where this occurs are

uXmega_CDC.INTERRUPT_TRNCOMPL:
uXmega_CDC.INTERRUPT_BUSEVENT:

I am sure that you are right about where it occurs but I cannot see where any _CDCxxxx are generated in the compiler. All I can see are references in the Release_News.
  • 1
  • 2
  • 3
  • Page 1 of 3
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 10 · Cache Hits: 14   136   150 · Page-Gen-Time: 0.026385s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI