Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when PWM1i is defined when using command wakeup #9466

Closed
11 of 15 tasks
Jason2866 opened this issue Oct 5, 2020 · 7 comments
Closed
11 of 15 tasks

Crash when PWM1i is defined when using command wakeup #9466

Jason2866 opened this issue Oct 5, 2020 · 7 comments
Labels
bug Type - Confirmated Bug fixed Result - The work on the issue has ended

Comments

@Jason2866
Copy link
Collaborator

Define a GPIO with function PWM1i.
Use command LedTable 1 and Dimmer 3 after that fire command wakeup -> crash.
Sometimes it already crashes with the Dimmer command.
Compiling Tasmota @160Mhz for the ESP makes it even worse.

The issue is already discussed in Discord. The crash is proabably caused from the used PWM code.
Tasmota actual uses PR esp8266/Arduino#7022 for Tasmota core 2.7.4.1
( https://github.com/tasmota/Arduino/tree/2.7.4.1-tasmota )

With some! tests it seems the issue is fixed using PR esp8266/Arduino#7231 instead.
( https://github.com/tasmota/Arduino/tree/2.7.4.1-PR7231 )

The shutter part and the AC-Zero-Cross Dimmer needs testing for compability for the changed PWM part.
@stefanbode and everyone else is invited to do tests. Thx in advance for doing.

For doing this download the provided platformio_override.ini.txt. Rename it to platformio_override.iniand copy it to your
root file of the Tasmota project folder. Rename your override file before ;-)

platformio_override.ini.txt

-->

PROBLEM DESCRIPTION

A clear and concise description of what the problem is.

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

  • Read the Contributing Guide and Policy and the Code of Conduct
  • Searched the problem in issues
  • Searched the problem in the docs
  • Searched the problem in the forum
  • Searched the problem in the chat
  • Device used (e.g., Sonoff Basic): NodeMCU
  • Tasmota binary firmware version number used: latest dev
    • Pre-compiled
    • Self-compiled
      • IDE / Compiler used: latest Platformio / VSC
  • Flashing tools used: Esptool
  • Provide the output of command: Backlog Template; Module; GPIO 255:
  Configuration output here:


  • If using rules, provide the output of this command: Backlog Rule1; Rule2; Rule3:
  Rules output here:


  • Provide the output of this command: Status 0:
  STATUS 0 output here:


  • Provide the output of the Console log output when you experience your issue; if applicable:
    (Please use weblog 4 for more debug information)
  Console output here:


TO REPRODUCE

see above

EXPECTED BEHAVIOUR

no crash

SCREENSHOTS

If applicable, add screenshots to help explain your problem.

ADDITIONAL CONTEXT

Add any other context about the problem here.

(Please, remember to close the issue when the problem has been addressed)

@s-hadinger
Copy link
Collaborator

The crash with PWM 7022 was a WDT reboot with no stack trace (even not with serial attached). Is the crash with ws2812 similar?

@arendst
Copy link
Owner

arendst commented Oct 5, 2020

The crashes with wd2812 were exceptions 0. Bad thing now is I cannot reproduce... Investigating.

arendst added a commit that referenced this issue Oct 5, 2020
Fix light wakeup exception 0 (divide by zero) when ``WakeupDuration`` is not initialised (#9466)
@arendst
Copy link
Owner

arendst commented Oct 5, 2020

Wakeup exception 0 fixed by latest commit

Background information. Received exception 0 like this:

"EPC":["4000e25d","00000000","00000000"],"EXCVADDR":"00000000","DEPC":"00000000","CallChain":["40221d72","40272a26","402729a5"...

Using valid .map file see:

4000e25d:
0x000000004000e21c                PROVIDE (__udivsi3 = 0x4000e21c)

40221d72:
0x0000000040221c9c                _Z12LightAnimatev

40272a26:
.irom.text.tasmota.h.337.2
0x00000000402729a5       0xbb E:\temp\.pioenvs\tasmota\src\tasmota.ino.cpp.o

The main issue is the first one (udivsi3) executed by LightAnimate. Searching source reveals the only divide in Animate() is this:

uint32_t step_10 = ((millis() - Light.wakeup_start_time) * 1023) / (Settings.light_wakeup * 1000);

Checking the value of Settings.light_wakeup using command WakeupDuration reports a value of 0. Changing it to any value but 0 solved the exception.

The fix makes sure Settings.light_wakeup will never be 0 again.

@Jason2866
Copy link
Collaborator Author

Did test with div 0 fix. Wakeup does work now in general.
The problem with dimmer and PWM1i inverted and random crash is still there when using Tasmota core (PR 7022 used)
I can generate no crash when using Core with PR7231. I suggest to change for development build to core with PR7231
to get feedback if there are any negative side effects

@arendst
Copy link
Owner

arendst commented Oct 6, 2020

Agree. Pls provide pr

Jason2866 added a commit to Jason2866/Tasmota that referenced this issue Oct 6, 2020
@Jason2866 Jason2866 mentioned this issue Oct 6, 2020
6 tasks
@s-hadinger
Copy link
Collaborator

+1. We just need to check the max frequency of 7231 because of impact on pwm fan

@ascillato2 ascillato2 added bug Type - Confirmated Bug fixed Result - The work on the issue has ended labels Oct 9, 2020
@Jason2866
Copy link
Collaborator Author

@s-hadinger did a test (pwm fan). Delivers a good signal at frequencys high enough for pwm fans.
So if there is not rising a hidden bug in 7231 it LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type - Confirmated Bug fixed Result - The work on the issue has ended
Projects
None yet
Development

No branches or pull requests

4 participants