ESP32-S3 Brownout disable

Code tips and tricks for beginners
Post Reply
User avatar
Dompie
Posts: 43
Joined: Tue Feb 09, 2021 12:59 pm
Has thanked: 58 times
Been thanked: 11 times

ESP32-S3 Brownout disable

Post by Dompie »

I have an esp32-S3 of which I switch on the battery power (N-Mosfet + P-Mosfet circuit) with a push button after which a PullUp powered through the ESP (now has voltage) keeps the N-Mosfet high. Switching off by making the PullUp low via an ESP32-S3 pin, which switches off the power. Switching on works fine, but switching off does start (ESP pin low) but because the voltage switches off the ESP32 gives a Brownout reset (wow the ESP32 is fast) and the pin that keeps the gate of the N-Mosfet low is also reset and gives 3.3V again through the pullup. Result: ESP32-S3 restarts again and autostart my program.
Solution: Disable brownout reset before the ESP pin is made low.
After searching I find that in Arduino

Code: [Local Link Removed for Guests]

WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
switches off the brownout. I think I should also be able to achieve this with a BAS.POKE addr, data IF I find the right address.
On Github from Espressif:
https://github.com/espressif/esp-idf/tr ... cntl_reg.h

Code: [Local Link Removed for Guests]

line 2563.....:
#define RTC_CNTL_BROWN_OUT_REG (DR_REG_RTCCNTL_BASE + 0xE8)
.......many bit descriptions.....
Now I know the offset but I can't find the address of DR_REG_RTCCNTL_BASE anywhere, so I'm stuck.

Can anyone help me find the address for DR_REG_RTCCNTL_BASE (or can I use the Arduino call in some way)???
User avatar
cicciocb
Site Admin
Posts: 2793
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 593 times
Been thanked: 1998 times
Contact:

Re: ESP32-S3 Brownout disable

Post by cicciocb »

esp32-S3 : (0x60008000 + 0xE8)
BeanieBots
Posts: 523
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 293 times
Been thanked: 165 times

Re: ESP32-S3 Brownout disable

Post by BeanieBots »

You might be able to fix it with a cap on the MOSFET (fed via resistor) such that a brief high on the IO pin is not enough to switch before the device completely powers down. ie a small delay on your ON circuit.
User avatar
Dompie
Posts: 43
Joined: Tue Feb 09, 2021 12:59 pm
Has thanked: 58 times
Been thanked: 11 times

Re: ESP32-S3 Brownout disable

Post by Dompie »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Sun Feb 02, 2025 4:13 pm esp32-S3 : (0x60008000 + 0xE8)
@cicciocb Thanks for the very fast response, but unfortunately it doesn't work. I think everything is simple but that isn't true!!
Result of my program:

Code: [Local Link Removed for Guests]

Adres=1610645736=$600080E8	-> bas.poke adres,0
 Before Poke=4FFFC020 after Poke=0
But still a Brownout Reset.
So I did some more digging on the Espressif site and found the real call that is called by the Arduino call. I think the ETS_UNCACHED_ADDR call does something completely different than I (simple soul) think. So the call is:

Code: [Local Link Removed for Guests]

Arduino call to switch of Brownout:WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);

Espressif: #define WRITE_PERI_REG(addr, val) do {                                                                                 \
            (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val);                                       \
        } while(0)
With the definitions:
#define RTC_CNTL_BROWN_OUT_REG          (DR_REG_RTCCNTL_BASE + 0xE8)
#define DR_REG_RTCCNTL_BASE                     0x60008000
So my simple idea of ​​simply Poking a ZERO at address 0x600080E8 doesn't work.

Does anyone have a good idea, otherwise I'll have to use a old-fasioned switch out of misery??

BTW, switching off this brown-out can also be a stopgap with the ESP-Cam that keeps rebooting.
User avatar
cicciocb
Site Admin
Posts: 2793
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 593 times
Been thanked: 1998 times
Contact:

Re: ESP32-S3 Brownout disable

Post by cicciocb »

Hi Dompie,
An important point to consider is that the brownout reset is a protective measure and a way to indicate that there's an issue in the power supply chain.
Disabling it is not the solution, as other problems might arise without apparent explanation.

I suggest fixing the power supply issues, including the one you have for the ESP-CAM.
This approach will address the root cause of the problem rather than masking its symptoms.
User avatar
Dompie
Posts: 43
Joined: Tue Feb 09, 2021 12:59 pm
Has thanked: 58 times
Been thanked: 11 times

Re: ESP32-S3 Brownout disable

Post by Dompie »

@cicciocb I don't have a power problem, but I want to switch off my power supply in my Annex program. The circuit works perfectly, but if the supply voltage drops due to switching off, a Brown-Out Reset of the ESP32-S3 occurs that resets the entire ESP and therefore also my pin that is switching off the circuit and so the switching off process is interrupted.
So I want to switch off the Brown-Out of the ESP so that the switching off process can continue.
Attached is a scope image that shows the situation exactly.
The blue line is the 5V supply of the buck converter and the yellow line is the pin that I make low in my program to switch off the power of the entire circuit. The Brown-Out reset (Red circle) clearly interrupts the yellow line and so I have to switch off the Brown-Out.
Can you make a solution to switch off de Brown-Out?
You do not have the required permissions to view the files attached to this post.
User avatar
cicciocb
Site Admin
Posts: 2793
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 593 times
Been thanked: 1998 times
Contact:

Re: ESP32-S3 Brownout disable

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Mon Feb 03, 2025 6:06 pm @cicciocb I don't have a power problem, but I want to switch off my power supply in my Annex program. The circuit works perfectly, but if the supply voltage drops due to switching off, a Brown-Out Reset of the ESP32-S3 occurs that resets the entire ESP and therefore also my pin that is switching off the circuit and so the switching off process is interrupted.
So I want to switch off the Brown-Out of the ESP so that the switching off process can continue.
Attached is a scope image that shows the situation exactly.
The blue line is the 5V supply of the buck converter and the yellow line is the pin that I make low in my program to switch off the power of the entire circuit. The Brown-Out reset (Red circle) clearly interrupts the yellow line and so I have to switch off the Brown-Out.
Can you make a solution to switch off de Brown-Out?
A capacitor could potentially solve the issue.
However, switching off the brownout detection does not guarantee that the processor will continue to function correctly, as it would be operating under-powered.
I'm not in favor of disabling the brownout detector because it would need to be permanently disabled, as the disable command must be the first instruction executed by the processor.
User avatar
Dompie
Posts: 43
Joined: Tue Feb 09, 2021 12:59 pm
Has thanked: 58 times
Been thanked: 11 times

Re: ESP32-S3 Brownout disable

Post by Dompie »

I want to switch off the power of the ESP from the software in that ESP. The process starts fine (see yellow line) only this switch off process is interrupted because the Brown-Out resets the ESP and also resets my low pin. (Ofcourse Annex is stopt and cann't run anymore).
The intention is that the power is switched off and the Brown-Out does not interfere with that.
I understood that when the ESP is switched on again the Brown-Out is switched on normally again during the initialization of the ESP (before Annex is started).
I hope I have made clear why I want to switch off the Brown-Out.
The question remains HOW I can achieve that.
User avatar
cicciocb
Site Admin
Posts: 2793
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 593 times
Been thanked: 1998 times
Contact:

Re: ESP32-S3 Brownout disable

Post by cicciocb »

I see what you mean and the solution is a capacitor
BeanieBots
Posts: 523
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 293 times
Been thanked: 165 times

Re: ESP32-S3 Brownout disable

Post by BeanieBots »

The solution really does need to be in your power switching circuit.
Several options. Put the ESP into deep sleep rather than turn it off.
Check your circuit does what is required. eg the control pin for off MUST be low to turn off.
Publish your circuit so we can check.
Post Reply