-->
Page 1 of 1

EDIT: not bugged after all, my mistake

PostPosted: Mon Mar 30, 2015 7:04 am
by draco
This weekend, I was trying to 'fade' an LED from fully off to fully on by slowly increasing the duty cycle. After about the sixth call to pwm.setduty(), the module reboots.

The results were the same across different firmwares (build 20150213 and 20130318) and module types (ESP-03 and ESP-12). Changing the pin used had no effect, nor did changing the step size -- no matter what step size used, I could only change it about six times before the module rebooted.

I think this code will demonstrate the problem. I am replicating it from memory since I'm at work and don't have my ESP modules with me.
Code: Select alllocal pin=8
pwm.setup(pin, 1000, 0)
pwm.start(pin)

for i=0,1000,100 do
  pwm.setduty(pin,i)
  tmr.delay(500000)
end

I tried doing a pwm.stop() and pwm.start() before and after the setduty calls, made no difference. I tried doing a full pwm.setup() call instead of pwm.setduty(), made no difference.

Re: pwm.setduty() crashes after repeated use

PostPosted: Mon Mar 30, 2015 9:35 am
by jankop
Insert tmr.wdclr() command to loop.

Re: pwm.setduty() crashes after repeated use

PostPosted: Tue Mar 31, 2015 5:12 am
by draco
jankop wrote:Insert tmr.wdclr() command to loop.


That did the trick. Wow, I had no idea that was a thing that could happen. Thanks!