ESP32 Setup ledc affect to wdt time
Posted: Mon Mar 16, 2020 10:08 pm
I've got few tests with ledc and i've got strange results.
If we use ledc like this:
It means I just want to generate pwm 10mhz on 32 pin. But with this configuration we have got WDT on ~10ms. And some interesting fact that esp32 reset automatically after 10ms and it happens again and again. But some time rst:0x10 (RTCWDT_RTC_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT) happened thas indicate about WDT Reset.
Output example:
But if we remove this code and it would be like this:
Counter newer stop. And any WDT errors never happens
So. What is wrong? Someone please help me
If we use ledc like this:
- void setup() {
- Serial.begin(115200);
- Serial.println(F("Start setup"));
- pinMode(GPIO_NUM_32, OUTPUT);
- pinMode(GPIO_NUM_32, LOW);
- ledcSetup(LEDC_CHANNEL_0, 10000000, 2 );
- ledcAttachPin(GPIO_NUM_32, LEDC_CHANNEL_0);
- ledcWrite(LEDC_CHANNEL_0, 2 );
- int time = 0;
- while(1) { Serial.println(time); delay(time++); }
- }
Output example:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- �Start setup
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- Start setup
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- ets Jun 8 2016 00:22:57
- rst:0x10 (RTCWDT_RTC_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
- configsip: 0, SPIWP:0xee
- clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
- mode:DIO, clock div:2
- load:0x3fff0018,len:4
- load:0xffffffff,len:-1
- ets Jun 8 2016 00:22:57
But if we remove this code and it would be like this:
- void setup() {
- Serial.begin(115200);
- Serial.println(F("Start setup"));
- int sec = 0;
- while(1) {
- Serial.println(sec);
- delay(sec++);
- }
- }
Counter newer stop. And any WDT errors never happens
- Start setup
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- .
- .
- .
- 187
- .
- .
- .
- 1000
- .
- .
- .