ESP32 Setup ledc affect to wdt time

w1zardgame
Posts: 1
Joined: Mon Mar 16, 2020 9:46 pm

ESP32 Setup ledc affect to wdt time

Postby w1zardgame » 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:
  1. void setup() {
  2.   Serial.begin(115200);
  3.  
  4.   Serial.println(F("Start setup"));
  5.  
  6.   pinMode(GPIO_NUM_32, OUTPUT);
  7.     pinMode(GPIO_NUM_32, LOW);
  8.     ledcSetup(LEDC_CHANNEL_0, 10000000, 2 );
  9.     ledcAttachPin(GPIO_NUM_32, LEDC_CHANNEL_0);
  10.     ledcWrite(LEDC_CHANNEL_0, 2 );
  11.  
  12.   int time = 0;
  13.   while(1) { Serial.println(time); delay(time++); }
  14.   }
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:
  1. 0
  2. 1
  3. 2
  4. 3
  5. 4
  6. 5
  7. 6
  8. 7
  9. 8
  10. 9
  11. 10
  12. �Start setup
  13. 0
  14. 1
  15. 2
  16. 3
  17. 4
  18. 5
  19. 6
  20. 7
  21. 8
  22. 9
  23. 10
  24. 11
  25. Start setup
  26. 0
  27. 1
  28. 2
  29. 3
  30. 4
  31. 5
  32. 6
  33. 7
  34. 8
  35. 9
  36. 10
  37. 11
  38. ets Jun  8 2016 00:22:57
  39.  
  40. rst:0x10 (RTCWDT_RTC_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
  41. configsip: 0, SPIWP:0xee
  42. clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
  43. mode:DIO, clock div:2
  44. load:0x3fff0018,len:4
  45. load:0xffffffff,len:-1
  46. ets Jun  8 2016 00:22:57

But if we remove this code and it would be like this:
  1. void setup() {
  2.   Serial.begin(115200);
  3.  
  4.   Serial.println(F("Start setup"));
  5.  
  6.   int sec = 0;
  7.   while(1) {
  8.     Serial.println(sec);
  9.     delay(sec++);
  10.   }
  11.   }

Counter newer stop. And any WDT errors never happens
  1. Start setup
  2. 0
  3. 1
  4. 2
  5. 3
  6. 4
  7. 5
  8. 6
  9. 7
  10. 8
  11. 9
  12. 10
  13. 11
  14. 12
  15. 13
  16. 14
  17. 15
  18. 16
  19. 17
  20. 18
  21. 19
  22. 20
  23. 21
  24. .
  25. .
  26. .
  27. 187
  28. .
  29. .
  30. .
  31. 1000
  32. .
  33. .
  34. .
So. What is wrong? Someone please help me :cry:

Who is online

Users browsing this forum: Google [Bot] and 99 guests