Page 1 of 1

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

Posted: Tue Nov 07, 2023 7:40 am
by momothepeach
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 4146 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?):

Code: Untitled.txt Select all


ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x1 (POWERON),boot:0xf (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5820,len:0x1738
load:0x403cc710,len:0xae8
load:0x403ce710,len:0x2e7c
entry 0x403cc71a
I (30) boot: ESP-IDF v5.1-dev-7241-g3640dc86bb-dirty 2nd stage bootloader
I (30) boot: compile time Nov 3 2023 15:51:58
I (31) boot: chip revision: v0.4
I (35) boot.esp32c3: SPI Speed : 80MHz
I (40) boot.esp32c3: SPI Mode : DIO
I (45) boot.esp32c3: SPI Flash Size : 2MB
I (50) boot: Enabling RNG early entropy source...
I (55) boot: Partition Table:
I (59) boot: ## Label Usage Type ST Offset Length
I (66) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (73) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (81) boot: 2 factory factory app 00 00 00010000 00100000
I (88) boot: End of partition table
I (92) esp_image: segment 0: paddr=00010020 vaddr=3c0c0020 size=2d4d8h (185560) map
I (130) esp_image: segment 1: paddr=0003d500 vaddr=3fc90c00 size=02b18h ( 11032) load
I (133) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=ba3e4h (762852) map
I (258) esp_image: segment 3: paddr=000fa40c vaddr=3fc93718 size=0073ch ( 1852) load
I (258) esp_image: segment 4: paddr=000fab50 vaddr=40380000 size=10a2ch ( 68140) load
I (282) boot: Loaded app from partition at offset 0x10000
I (282) boot: Disabling RNG early entropy source...
I (294) cpu_start: Unicore app
I (294) cpu_start: Pro cpu up.
I (302) cpu_start: Pro cpu start user code
I (302) cpu_start: cpu freq: 160000000 Hz
I (303) cpu_start: Application information:
I (305) cpu_start: Project name: homekit-switch
I (311) cpu_start: App version: c0b0074-dirty
I (316) cpu_start: Compile time: Nov 7 2023 12:34:43
I (323) cpu_start: ELF file SHA256: 917335dbb...
I (328) cpu_start: ESP-IDF: v5.1-dev-7241-g3640dc86bb-dirty
I (335) cpu_start: Min chip rev: v0.3
I (340) cpu_start: Max chip rev: v0.99
I (345) cpu_start: Chip rev: v0.4
I (349) heap_init: Initializing. RAM available for dynamic allocation:
I (357) heap_init: At 3FC98E10 len 00043900 (270 KiB): DRAM
I (363) heap_init: At 3FCDC710 len 00002950 (10 KiB): STACK/DRAM
I (369) heap_init: At 50000010 len 00001FD8 (7 KiB): RTCRAM
I (376) spi_flash: detected chip: generic
I (380) spi_flash: flash io: dio
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.
I (398) sleep: Configure to isolate all GPIO pins in sleep state
I (404) sleep: Enable automatic switching of GPIO sleep configuration
I (411) app_start: Starting scheduler on CPU0
I (416) main_task: Started on CPU0
I (416) main_task: Calling app_main()
Keystore initialised
Accessory is not Paired with any controller
Database initialised. Accessory Device ID: FC:BD:98:7C:FF:BC
HAP Initialization succeeded. Version : 4.0-bd236e7
I (3436) pp: pp rom version: 9387209
I (3436) net80211: net80211 rom version: 9387209
I (3446) wifi:wifi driver task: 3fca24d8, prio:23, stack:6656, core=0
I (3446) wifi:wifi firmware version: e03c1ca
I (3446) wifi:wifi certification version: v7.0
I (3446) wifi:config NVS flash: enabled
I (3446) wifi:config nano formating: disabled
I (3456) wifi:Init data frame dynamic rx buffer num: 32
I (3456) wifi:Init management frame dynamic rx buffer num: 32
I (3466) wifi:Init management short buffer num: 32
I (3466) wifi:Init dynamic tx buffer num: 32
I (3476) wifi:Init static tx FG buffer num: 2
I (3476) wifi:Init static rx buffer size: 1600
I (3476) wifi:Init static rx buffer num: 10
I (3486) wifi:Init dynamic rx buffer num: 32
I (3486) wifi_init: rx ba win: 6
I (3496) wifi_init: tcpip mbox: 32
I (3496) wifi_init: udp mbox: 6
I (3496) wifi_init: tcp mbox: 6
I (3506) wifi_init: tcp tx win: 5744
I (3506) wifi_init: tcp rx win: 5744
I (3516) wifi_init: tcp mss: 1440
I (3516) wifi_init: WiFi IRAM OP enabled
I (3516) wifi_init: WiFi RX IRAM OP enabled
I (3526) phy_init: phy_version 1110,9c20f0a,Jul 27 2023,10:42:54
I (3816) wifi:mode : sta (ec:da:3b:c8:b5:d0)
I (3816) wifi:enable tsf
I (3816) wifi: Connecting to xxx...
I (3826) wifi: Waiting for IP address
I (44�ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x1 (POWERON),boot:0xf (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5820,len:0x1738
load:0x403cc710,len:0xae8
load:0x403ce710,len:0x2e7c
entry 0x403cc71a
I (30) boot: ESP-IDF v5.1-dev-7241-g3640dc86bb-dirty 2nd stage bootloader
I (30) boot: compile time Nov 3 2023 15:51:58
I (31) boot: chip revision: v0.4
I (35) boot.esp32c3: SPI Speed : 80MHz
I (40) boot.esp32c3: SPI Mode : DIO
I (45) boot.esp32c3: SPI Flash Size : 2MB
I (50) boot: Enabling RNG early entropy source...
I (55) boot: Partition Table:
I (59) boot: ## Label Usage Type ST Offset Length
I (66) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (73) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (81) boot: 2 factory factory app 00 00 00010000 00100000
I (88) boot: End of partition table
I (92) esp_image: segment 0: paddr=00010020 vaddr=3c0c0020 size=2d4d8h (185560) map
I (130) esp_image: segment 1: paddr=0003d500 vaddr=3fc90c00 size=02b18h ( 11032) load
I (133) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=ba3e4h (762852) map
I (258) esp_image: segment 3: paddr=000fa40c vaddr=3fc93718 size=0073ch ( 1852) load
I (258) esp_image: segment 4: paddr=000fab50 vaddr=40380000 size=10a2ch ( 68140) load
I (282) boot: Loaded app from partition at offset 0x10000
I (282) boot: Disabling RNG early entropy source...
I (294) cpu_start: Unicore app
I (294) cpu_start: Pro cpu up.
I (302) cpu_start: Pro cpu start user code
I (302) cpu_start: cpu freq: 160000000 Hz
I (303) cpu_start: Application information:
I (305) cpu_start: Project name: homekit-switch
I (311) cpu_start: App version: c0b0074-dirty
I (316) cpu_start: Compile time: Nov 7 2023 12:34:43
I (323) cpu_start: ELF file SHA256: 917335dbb...
I (328) cpu_start: ESP-IDF: v5.1-dev-7241-g3640dc86bb-dirty
I (335) cpu_start: Min chip rev: v0.3
I (340) cpu_start: Max chip rev: v0.99
I (345) cpu_start: Chip rev: v0.4
I (349) heap_init: Initializing. RAM available for dynamic allocation:
I (357) heap_init: At 3FC98E10 len 00043900 (270 KiB): DRAM
I (363) heap_init: At 3FCDC710 len 00002950 (10 KiB): STACK/DRAM
I (369) heap_init: At 50000010 len 00001FD8 (7 KiB): RTCRAM
I (376) spi_flash: detected chip: generic
I (380) spi_flash: flash io: dio
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.
I (398) sleep: Configure to isolate all GPIO pins in sleep state
I (404) sleep: Enable automatic switching of GPIO sleep configuration
I (411) app_start: Starting scheduler on CPU0
I (416) main_task: Started on CPU0
I (416) main_task: Calling app_main()
Keystore initialised
Accessory is not Paired with any controller
Database initialised. Accessory Device ID: FC:BD:98:7C:FF:BC
HAP Initialization succeeded. Version : 4.0-bd236e7
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x1 (POWERON),boot:0xd (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
I'm new to hardware design, anything could be helpful, Thanks.

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

Posted: Tue Nov 07, 2023 4:43 pm
by Sprite
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?

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

Posted: Wed Nov 08, 2023 7:30 am
by momothepeach
@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 4029 times

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

Posted: Wed Jun 05, 2024 7:48 am
by suycksuyck
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.

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

Posted: Fri Jun 07, 2024 12:52 am
by Sprite
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.

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

Posted: Sun Jun 09, 2024 11:04 am
by RandomInternetGuy
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.

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

Posted: Tue Jun 11, 2024 10:05 am
by eriksl
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.