-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
analogWrite causes reboot #4321
Comments
Does it still happen, if you comment out the call to analogWriteRange()? |
@yukini3 I can't reproduce this, and I tried on a WittyCloud and a Wemos D1 mini R2. The LED pulses correctly. I used the onboard RGB n the Witty and builtin led on the D1 mini. Are you using a generic board? Such resets are typical of a bad power supply, noise or bad connections, (bad protoboard), or a bad LED pin (e,g,; resistor too small or damaged, or damaged pin, etc). More unlikely, you have a board with bad flash, or you flashed at too high speed (going above 230Kbps for flashing your sketch is just asking for trouble). Closing as can't reproduce. |
I purchased Wemos D1 mini R2 and was able to reproduce this problem. You need to run little longer than you did in order to reproduce. Although you think this is due to faulty wire or noise or lack of power but I think that this is other factor is involved. I looked into the code for further investigation and found that the fault is always happening at the same place - timer1_write(1); in pwm_start_timer();. Because I was able to pin point the fault, I can workaround this fault by not calling pwm_start_timer() which you would call analogWrite with dummy PIN and non zero value for the PWM (ex. analogWrite(DUMMY_PIN, 10);) at the start of your code (it calls pwm_start_timer()) and don't change the value so that further pwm_start_timer calling wouldn't occur. I deployed this workaround in my production code and now running for over 3 days without problem. For those of who having experiencing PWM problem, you could try this workaround. |
I ran for something like 30mins on each board, and I still can't reproduce. |
better idea, send your bin uploaded here so someone can flash it, if they CAN reproduce it it must be your installation issue of IDE/outdated core files.. |
Tonight I left an NodeMCU with the sketch supplied running and this morning I had 5 WDT. I'm going to update git and activate debug messages, to see if I get any more information. |
How do you power your ESPs ? |
With a USB3 port on a PC too. I never have WDT problems with this board and this supply. And sometimes I've had him running for a long time with other sketchs. UPDATE: 7 hours and 3 WDT, debug does not return any valuable information. |
Apologize for my delay. Here's the code of workaround.
|
Is this still valid with release 2.4.1? |
It still does also something wrong with SDK version number? SDK Version=00000000 ets Jan 8 2013,rst cause:4, boot mode:(3,7) wdt reset |
I have exactly the same problem with 2.4.1 i thought i was going crazy, tried 3 different board, 3 power suply (including a lab one directly on the 3.3v), and 4 differents prototype circuitry (2 lab boards 2 soldered) all had was ramdom freeze on a call to analogwrite on a led driven by a darlington array. thanks you yukini3 your workaround did save my life even though it cost me one gpio. |
it might be related to networking. the led i use with the analogwrite change color depending of network status: white = not connected; orange connected, |
I can reproduce this wdt bug too, by including this sketch in another one doing network things (and which is proven to not wdt-fail by itself alone). |
meanwhile someone on an other thread suggest to use a non existing dummy pin (255) this way you don't sacrifice a gpio for the workaround |
Can you try and repeat the bug with this quick fix ?
|
I spoke too fast, I just got my wdt again with the above patch. |
I'm currently trying #4640 from @earlephilhower.
and restart the IDE |
Almost 3 days without wdt, led is still breathing while doing network traffic at the same time. |
Is there a plan when this will be released? Will it be in v2.4.2 ? |
It is merged, so it will be in 2.4.2. Due date is August, 1st. |
Basic Infos
Although this issue is discussed and closed on #2238, this is still happening on my ESP8266s.
Hardware
Hardware: ESP-12
Core Version: 2.4.0
Description
analogWrite causes system reboot. To repro this problem, run the attached code and WAIT for a while. It happens randomly. Sometimes 10 minutes, somtimes few hours etc.
Settings in IDE
Module: Generic ESP8266 Module
Flash Size: 4MB/1MB
CPU Frequency: 80Mhz
Flash Mode: qio
Flash Frequency: 40Mhz?
Upload Using: OTA / SERIAL
Reset Method: ck / nodemcu
Sketch
Debug Messages
The text was updated successfully, but these errors were encountered: