-->
Page 1 of 2

PWM on GPIO0 or GPIO2 lets Prog crash

PostPosted: Thu Feb 05, 2015 3:45 am
by ulko
Hi,
I have defined PWM_CHANNEL = 4.
PWM 0,1,2 on GPIO12,13,14 works perfect.
But PWM3 on GPIO0 or GPIO2 lets program crash.
Define( added in pwm.h):
Code: Select all#define PWM_3_OUT_IO_MUX PERIPHS_IO_MUX_GPIO2_U   //weiss
#define PWM_3_OUT_IO_NUM 2
#define PWM_3_OUT_IO_FUNC  FUNC_GPIO2

Usage:
Code: Select all      pwm_set_duty(atoi(buff), 3);
      pwm_start();

added in pwm.c/pwm_init():
Code: Select all    PIN_FUNC_SELECT(PWM_3_OUT_IO_MUX, PWM_3_OUT_IO_FUNC);

What is wrong????

Re: PWM on GPIO0 or GPIO2 lets Prog crash

PostPosted: Thu Feb 05, 2015 12:12 pm
by sfranzyshen
I thought PWMs are only supported on GPIOs 12,13, & 15 ...

Re: PWM on GPIO0 or GPIO2 lets Prog crash

PostPosted: Thu Feb 05, 2015 12:43 pm
by ulko
Hi again,
I found the reason in pwm.c line 25; I added the 4. item:
Code: Select allLOCAL uint8 pwm_out_io_num[PWM_CHANNEL] = {PWM_0_OUT_IO_NUM, PWM_1_OUT_IO_NUM, PWM_2_OUT_IO_NUM, PWM_3_OUT_IO_NUM};

By that the 4 PWM outputs on GPIO12,13,14,2 work properly :D but unfortunatly only for a while :cry: .
The program in ESP is a modified esphttpd and gets a lot of commands from NETIO-APP to modify the duty cycle. After about 100-200 commands the program crashes with:
Code: Select allmalloc assert!

 ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x40100000, len 28300, room 16
tail 12
chksum 0x4a
ho 0 tail 12 room 4
load 0x3ffe8000, len 2924, room 12
tail 0
chksum 0x66
load 0x3ffe8b70, len 5772, room 8
tail 4
chksum 0x10
csum 0x10
r

ESP8266 in STATION mode, restarting in STATION mode...

My modifications do not use malloc, so perhaps any one can find the error by looking at the printout??
Regards

Re: PWM on GPIO0 or GPIO2 lets Prog crash

PostPosted: Thu Aug 27, 2015 2:11 pm
by limpkin
hey there,

did you find a solution to your problem?