ESP32-C3-WROOM-02 keeps rebooting while connecting WiFi

momothepeach
Posts: 2
Joined: Tue Nov 07, 2023 7:09 am

ESP32-C3-WROOM-02 keeps rebooting while connecting WiFi

Postby momothepeach » Tue Nov 07, 2023 7:40 am

Dear ESP32 forum,

I just designed a PCB as per the esp32-c3-wroom-02_datasheet here https://www.espressif.com/sites/default ... eet_en.pdf:
Image
Xnip2023-11-07_15-25-11.png
Xnip2023-11-07_15-25-11.png (233.34 KiB) Viewed 2502 times
.

Everytime I try to connect to WiFi, it restarts with reset reason POWERON, I think it's very strange. The very first time I used a AMS1117-3.3 for power supply. After some googling, it told me that the reset reason is insufficient current, now I changed it to SGM2212-3.3XKC3G/TR, which is used by the official DevKit here: https://dl.espressif.com/dl/schematics/ ... 00915A.pdf. But the problem persists. Two days of investigating, I still don't know why.

Notice line no. 88 and 145, the time I connect to WiFi, it resets (POWERON, not software reset or brownout reset, etc. how could it be?):
  1. ESP-ROM:esp32c3-api1-20210207
  2. Build:Feb  7 2021
  3. rst:0x1 (POWERON),boot:0xf (SPI_FAST_FLASH_BOOT)
  4. SPIWP:0xee
  5. mode:DIO, clock div:1
  6. load:0x3fcd5820,len:0x1738
  7. load:0x403cc710,len:0xae8
  8. load:0x403ce710,len:0x2e7c
  9. entry 0x403cc71a
  10. I (30) boot: ESP-IDF v5.1-dev-7241-g3640dc86bb-dirty 2nd stage bootloader
  11. I (30) boot: compile time Nov  3 2023 15:51:58
  12. I (31) boot: chip revision: v0.4
  13. I (35) boot.esp32c3: SPI Speed      : 80MHz
  14. I (40) boot.esp32c3: SPI Mode       : DIO
  15. I (45) boot.esp32c3: SPI Flash Size : 2MB
  16. I (50) boot: Enabling RNG early entropy source...
  17. I (55) boot: Partition Table:
  18. I (59) boot: ## Label            Usage          Type ST Offset   Length
  19. I (66) boot:  0 nvs              WiFi data        01 02 00009000 00006000
  20. I (73) boot:  1 phy_init         RF data          01 01 0000f000 00001000
  21. I (81) boot:  2 factory          factory app      00 00 00010000 00100000
  22. I (88) boot: End of partition table
  23. I (92) esp_image: segment 0: paddr=00010020 vaddr=3c0c0020 size=2d4d8h (185560) map
  24. I (130) esp_image: segment 1: paddr=0003d500 vaddr=3fc90c00 size=02b18h ( 11032) load
  25. I (133) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=ba3e4h (762852) map
  26. I (258) esp_image: segment 3: paddr=000fa40c vaddr=3fc93718 size=0073ch (  1852) load
  27. I (258) esp_image: segment 4: paddr=000fab50 vaddr=40380000 size=10a2ch ( 68140) load
  28. I (282) boot: Loaded app from partition at offset 0x10000
  29. I (282) boot: Disabling RNG early entropy source...
  30. I (294) cpu_start: Unicore app
  31. I (294) cpu_start: Pro cpu up.
  32. I (302) cpu_start: Pro cpu start user code
  33. I (302) cpu_start: cpu freq: 160000000 Hz
  34. I (303) cpu_start: Application information:
  35. I (305) cpu_start: Project name:     homekit-switch
  36. I (311) cpu_start: App version:      c0b0074-dirty
  37. I (316) cpu_start: Compile time:     Nov  7 2023 12:34:43
  38. I (323) cpu_start: ELF file SHA256:  917335dbb...
  39. I (328) cpu_start: ESP-IDF:          v5.1-dev-7241-g3640dc86bb-dirty
  40. I (335) cpu_start: Min chip rev:     v0.3
  41. I (340) cpu_start: Max chip rev:     v0.99
  42. I (345) cpu_start: Chip rev:         v0.4
  43. I (349) heap_init: Initializing. RAM available for dynamic allocation:
  44. I (357) heap_init: At 3FC98E10 len 00043900 (270 KiB): DRAM
  45. I (363) heap_init: At 3FCDC710 len 00002950 (10 KiB): STACK/DRAM
  46. I (369) heap_init: At 50000010 len 00001FD8 (7 KiB): RTCRAM
  47. I (376) spi_flash: detected chip: generic
  48. I (380) spi_flash: flash io: dio
  49. W (384) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
  50. I (398) sleep: Configure to isolate all GPIO pins in sleep state
  51. I (404) sleep: Enable automatic switching of GPIO sleep configuration
  52. I (411) app_start: Starting scheduler on CPU0
  53. I (416) main_task: Started on CPU0
  54. I (416) main_task: Calling app_main()
  55. Keystore initialised
  56. Accessory is not Paired with any controller
  57. Database initialised. Accessory Device ID: FC:BD:98:7C:FF:BC
  58. HAP Initialization succeeded. Version : 4.0-bd236e7
  59. I (3436) pp: pp rom version: 9387209
  60. I (3436) net80211: net80211 rom version: 9387209
  61. I (3446) wifi:wifi driver task: 3fca24d8, prio:23, stack:6656, core=0
  62. I (3446) wifi:wifi firmware version: e03c1ca
  63. I (3446) wifi:wifi certification version: v7.0
  64. I (3446) wifi:config NVS flash: enabled
  65. I (3446) wifi:config nano formating: disabled
  66. I (3456) wifi:Init data frame dynamic rx buffer num: 32
  67. I (3456) wifi:Init management frame dynamic rx buffer num: 32
  68. I (3466) wifi:Init management short buffer num: 32
  69. I (3466) wifi:Init dynamic tx buffer num: 32
  70. I (3476) wifi:Init static tx FG buffer num: 2
  71. I (3476) wifi:Init static rx buffer size: 1600
  72. I (3476) wifi:Init static rx buffer num: 10
  73. I (3486) wifi:Init dynamic rx buffer num: 32
  74. I (3486) wifi_init: rx ba win: 6
  75. I (3496) wifi_init: tcpip mbox: 32
  76. I (3496) wifi_init: udp mbox: 6
  77. I (3496) wifi_init: tcp mbox: 6
  78. I (3506) wifi_init: tcp tx win: 5744
  79. I (3506) wifi_init: tcp rx win: 5744
  80. I (3516) wifi_init: tcp mss: 1440
  81. I (3516) wifi_init: WiFi IRAM OP enabled
  82. I (3516) wifi_init: WiFi RX IRAM OP enabled
  83. I (3526) phy_init: phy_version 1110,9c20f0a,Jul 27 2023,10:42:54
  84. I (3816) wifi:mode : sta (ec:da:3b:c8:b5:d0)
  85. I (3816) wifi:enable tsf
  86. I (3816) wifi: Connecting to xxx...
  87. I (3826) wifi: Waiting for IP address
  88. I (44�ESP-ROM:esp32c3-api1-20210207
  89. Build:Feb  7 2021
  90. rst:0x1 (POWERON),boot:0xf (SPI_FAST_FLASH_BOOT)
  91. SPIWP:0xee
  92. mode:DIO, clock div:1
  93. load:0x3fcd5820,len:0x1738
  94. load:0x403cc710,len:0xae8
  95. load:0x403ce710,len:0x2e7c
  96. entry 0x403cc71a
  97. I (30) boot: ESP-IDF v5.1-dev-7241-g3640dc86bb-dirty 2nd stage bootloader
  98. I (30) boot: compile time Nov  3 2023 15:51:58
  99. I (31) boot: chip revision: v0.4
  100. I (35) boot.esp32c3: SPI Speed      : 80MHz
  101. I (40) boot.esp32c3: SPI Mode       : DIO
  102. I (45) boot.esp32c3: SPI Flash Size : 2MB
  103. I (50) boot: Enabling RNG early entropy source...
  104. I (55) boot: Partition Table:
  105. I (59) boot: ## Label            Usage          Type ST Offset   Length
  106. I (66) boot:  0 nvs              WiFi data        01 02 00009000 00006000
  107. I (73) boot:  1 phy_init         RF data          01 01 0000f000 00001000
  108. I (81) boot:  2 factory          factory app      00 00 00010000 00100000
  109. I (88) boot: End of partition table
  110. I (92) esp_image: segment 0: paddr=00010020 vaddr=3c0c0020 size=2d4d8h (185560) map
  111. I (130) esp_image: segment 1: paddr=0003d500 vaddr=3fc90c00 size=02b18h ( 11032) load
  112. I (133) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=ba3e4h (762852) map
  113. I (258) esp_image: segment 3: paddr=000fa40c vaddr=3fc93718 size=0073ch (  1852) load
  114. I (258) esp_image: segment 4: paddr=000fab50 vaddr=40380000 size=10a2ch ( 68140) load
  115. I (282) boot: Loaded app from partition at offset 0x10000
  116. I (282) boot: Disabling RNG early entropy source...
  117. I (294) cpu_start: Unicore app
  118. I (294) cpu_start: Pro cpu up.
  119. I (302) cpu_start: Pro cpu start user code
  120. I (302) cpu_start: cpu freq: 160000000 Hz
  121. I (303) cpu_start: Application information:
  122. I (305) cpu_start: Project name:     homekit-switch
  123. I (311) cpu_start: App version:      c0b0074-dirty
  124. I (316) cpu_start: Compile time:     Nov  7 2023 12:34:43
  125. I (323) cpu_start: ELF file SHA256:  917335dbb...
  126. I (328) cpu_start: ESP-IDF:          v5.1-dev-7241-g3640dc86bb-dirty
  127. I (335) cpu_start: Min chip rev:     v0.3
  128. I (340) cpu_start: Max chip rev:     v0.99
  129. I (345) cpu_start: Chip rev:         v0.4
  130. I (349) heap_init: Initializing. RAM available for dynamic allocation:
  131. I (357) heap_init: At 3FC98E10 len 00043900 (270 KiB): DRAM
  132. I (363) heap_init: At 3FCDC710 len 00002950 (10 KiB): STACK/DRAM
  133. I (369) heap_init: At 50000010 len 00001FD8 (7 KiB): RTCRAM
  134. I (376) spi_flash: detected chip: generic
  135. I (380) spi_flash: flash io: dio
  136. W (384) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
  137. I (398) sleep: Configure to isolate all GPIO pins in sleep state
  138. I (404) sleep: Enable automatic switching of GPIO sleep configuration
  139. I (411) app_start: Starting scheduler on CPU0
  140. I (416) main_task: Started on CPU0
  141. I (416) main_task: Calling app_main()
  142. Keystore initialised
  143. Accessory is not Paired with any controller
  144. Database initialised. Accessory Device ID: FC:BD:98:7C:FF:BC
  145. HAP Initialization succeeded. Version : 4.0-bd236e7
  146. ESP-ROM:esp32c3-api1-20210207
  147. Build:Feb  7 2021
  148. rst:0x1 (POWERON),boot:0xd (SPI_FAST_FLASH_BOOT)
  149. SPIWP:0xee
I'm new to hardware design, anything could be helpful, Thanks.

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-C3-WROOM-02 keeps rebooting while connecting WiFi

Postby ESP_Sprite » Tue Nov 07, 2023 4:43 pm

If any, you're missing a capacitor (1uF or so) from the EN line to ground. I'd add that to the PCB if I were you, but I don't think that's the issue here.

Are you sure this is a hardware problem? As in does the firmware not crash if you program it into a known-good board like a devkit?

momothepeach
Posts: 2
Joined: Tue Nov 07, 2023 7:09 am

Re: ESP32-C3-WROOM-02 keeps rebooting while connecting WiFi

Postby momothepeach » Wed Nov 08, 2023 7:30 am

@ESP_Sprite Thank you for your reply. I can be sure it's not a software problem, because it happens only when the time I connect to WiFi. And it will now happen on a official DevKit board.

For the capacitor, I carefully compared my PCB board with the official Peripheral Schematics, https://www.espressif.com/sites/default ... #section.6, some capacitors were missing. After adding them, my board can now connect to WiFi without resets.

But, it's not very stable (as in disconnecting...reconnecting...disconecting...reconnecting). This board is actually a Switch (for controlling light bulb on the roof), I'm using a Transformer to convert the AC to DC 5V, and then a LDO to 3.3V. And a Relay. Will the transformer and Relay make some impacts on the ESP32 RF?
Xnip2023-11-08_15-25-40.png
Xnip2023-11-08_15-25-40.png (270.79 KiB) Viewed 2385 times

suycksuyck
Posts: 1
Joined: Wed Jun 05, 2024 7:41 am

Re: ESP32-C3-WROOM-02 keeps rebooting while connecting WiFi

Postby suycksuyck » Wed Jun 05, 2024 7:48 am

Dear @momothepeach,
I have the same problem as you, is your problem resolved so far ?
Would you please share to me the solution ?

Thank you.

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-C3-WROOM-02 keeps rebooting while connecting WiFi

Postby ESP_Sprite » Fri Jun 07, 2024 12:52 am

momothepeach wrote:
Wed Nov 08, 2023 7:30 am
But, it's not very stable (as in disconnecting...reconnecting...disconecting...reconnecting). This board is actually a Switch (for controlling light bulb on the roof), I'm using a Transformer to convert the AC to DC 5V, and then a LDO to 3.3V. And a Relay. Will the transformer and Relay make some impacts on the ESP32 RF?
It could have. I'm not gonna pretend I know a lot about RF magic, but having large chunks of metal close to the ESP32 probably isn't good for RF performance, and depending on your PCB layout you could have issues with RF from the mains getting to your ESP.

RandomInternetGuy
Posts: 52
Joined: Fri Aug 11, 2023 4:56 am

Re: ESP32-C3-WROOM-02 keeps rebooting while connecting WiFi

Postby RandomInternetGuy » Sun Jun 09, 2024 11:04 am

It's not the actual question, but when the magnetic field in your relay collapses and it needs to dump many tens/hundreds of volts into a spike somewhere, where does that go? It's possible this board handles it, but I don't see the requisite parts. Stick a scope with a trigger on the trailing edge of your transistor activation and another channel on the coil and watch the voltage spike as the coil deactivates. This is electrodynamics at work. :?


Also, just from a cost/serviceability/heat dissipation view, having a chunky transformer millimeters from an MCU (especially one with radios in it) probably isn't very awesome. Power supplies are usually on different PCBs for a good reason. Take apart ten pieces of tech in your house and count the number of PCBs that physically look like this.

There may be a parlance problem, but the output of a transformer is AC. Your board doesn't contain an obvious rectifier/filtering stage. Next, aim your scope at your DC 3.3V and see if it's as clean across reconnections as you think it is. It doesn't take a lot of ripple to turn into reboots.

Hint: All these are well discussed on the web and none of this is actually specific to this MCU.

If you're so sure this is a problem with Espressif's own hardware and not your code, please post a reproducible, self-contained example that demonstrates it. That'll make it easier for others to help reproduce it If it happens only after you've surrounded Espressif's board with your own hardware, you'll have a clearer answer. I suspect that after you eliminate the two coils you'll find that Espressif's reference modules do not, in fact, reboot when "reconnecting", whether that definition means either the board connecting to the upstream WiFI carrier or to the remote triggering source that build a connection to cause the light to toggle. There are simply too many of these in use around the world doing this very thing, including often inside light bulbs themselves.

I'm a mere software guy, but the EMI on this board looks worth questioning.

eriksl
Posts: 116
Joined: Thu Dec 14, 2023 3:23 pm
Location: Netherlands

Re: ESP32-C3-WROOM-02 keeps rebooting while connecting WiFi

Postby eriksl » Tue Jun 11, 2024 10:05 am

Besides this also another important point: the power supply. This should be really good, or expect to have problems. An ESP is a not a light bulb. When you start using wifi actively, the power use will raise significantly. If the power supply isn't up to it, the module will have trouble associating. Or worse, the brownout detector will kick in and reset the chip. This is probably what you're seeing. Most of the time the power supply will actually be able to supply enough power, but not quick enough. This is where you add not one but two capacitors as close as possible to the ESP. One large electrolytic (1 uF will probably do, but more is better) and one smaller ceramic or other quick-responding type (like Mylar etc.). A value of 100 nF will do most of the time. The second capacitor will serve two goals: firstly it will protect the first capacitor from high frequency noise, which electrolytic capacitors don't like (has a negative impact on their lifespan) but secondly, they will respond far more quickly to voltage variation, which for, especially an RF device, is crucial. You don't want any high frequency noise to end up in the RF signal.

Besides that, I'd recommend adding a 100 nF ceramic capacitor directly to the EN pin, so any (short) power variations will not lightly change the state of the pin. Believe me, since I practice this, I've had a lot less crashes due to TL lights in the neighbourhood being switched etc. As you're using a "hard" (mechanic) switch, it's recommend to also add a resistor in series with this capacitor, because otherwise the capacitor may dump it's charge in one go into the pin upon switching, which the pin may not like. Especially for ceramic capacitors, as they have a very low ESR, this can be a problem.

Who is online

Users browsing this forum: No registered users and 100 guests