ESP32 not loading program when GPIO set high before powering

Thread Starter

zazas321

Joined Nov 29, 2015
936
20200806_142502.jpg

This is the schematic I have drawn. and the code :
Code:
#include <NeoPixelBus.h>
uint64_t chipid;  
const uint16_t PixelCount = 6; // this example assumes 4 pixels, making it smaller will cause a failure
const uint8_t PixelPin = 2;  // make sure to set this to the correct pin, ignored for Esp8266
#define colorSaturation 20
NeoPixelBus<NeoGrbFeature, NeoEsp32Rmt0800KbpsMethod> strip(PixelCount, PixelPin);
RgbColor red(colorSaturation, 0, 0);
RgbColor green(0, colorSaturation, 0);
RgbColor blue(0, 0, colorSaturation);
RgbColor white(colorSaturation);
RgbColor black(0);
RgbColor purple(colorSaturation, 0, colorSaturation);
HslColor hslRed(red);
HslColor hslGreen(green);
HslColor hslBlue(blue);
HslColor hslWhite(white);
HslColor hslBlack(black);
void setup() {
    Serial.begin(115200);
 strip.Begin();
}

void loop() {
    chipid=ESP.getEfuseMac();//The chip ID is essentially its MAC address(length: 6 bytes).
    Serial.printf("ESP32 Chip ID = %04X",(uint16_t)(chipid>>32));//print High 2 bytes
    Serial.printf("%08X\n",(uint32_t)chipid);//print Low 4bytes.
  LED_strip_ON(green,6);
  delay(1000);
  LED_strip_ON(black,6);
    delay(3000);

}
void LED_strip_ON(RgbColor colour,int number){
    for (int i=0;i<number;i++)
         strip.SetPixelColor(i, colour);
          strip.Show();
}
The program is very simple, just blink and LED strip and read device ID.

I have also implemented a sensor but not currently using it. It is 12V proximity sensor using open collector transistor. I just use a voltage divider circuit to step the voltage down to 3.3V logic level and connect it to GPIO pin of my ESP32 device. I have tested and the sensor works, it outputs me 3.3V when there is no obstacle in front of it and 0V when I put my hand in front of it.


I have 2 seperate power supplies. 5V and 12V. The very weird problem I have , when i switch 12V supply ON to power the sensor (also sends HIGH signal to one of the GPIO), after switching on 5V, the onboard LED on my esp32 turns ON, but the board does not execute code!. When I do it the other way arround, first powering the board (5V) board immidiately starts executing code, I can see LEDS blinking then I can power up my sensor by enabling 12V.

basically:
1. turn ON 12V
2. turn ON 5V
3. Board turned ON but not executing code


1. turn ON 5V
2. Board immidiately starts working(executing code)
3. turn ON 12V.


When I disconnect the GPIO sensor pin from the board, the board works fine when enabling 12V first. Can someone explain me how does sending HIGH signal to one of the GPIOs before powering board not allowing it to execute code????
 

Analog Ground

Joined Apr 24, 2019
460
You don't say what the power/GPIO sequences are which cause the problem but you could have what is called a "false power down". Moving the input to a different GPIO pin may have fixed the problem for now but without knowing the cause of the problem, it could come back at any time. Is the brown out reset circuit in the microcontroller enabled? If not, try going back to the original pin and enable the BOR circuit. If the problem goes away, there is your problem. Here is an article on the subject.
https://www.allaboutcircuits.com/te...set-microcontroller-prevent-false-power-down/
 

Thread Starter

zazas321

Joined Nov 29, 2015
936
You don't say what the power/GPIO sequences are which cause the problem but you could have what is called a "false power down". Moving the input to a different GPIO pin may have fixed the problem for now but without knowing the cause of the problem, it could come back at any time. Is the brown out reset circuit in the microcontroller enabled? If not, try going back to the original pin and enable the BOR circuit. If the problem goes away, there is your problem. Here is an article on the subject.
https://www.allaboutcircuits.com/te...set-microcontroller-prevent-false-power-down/
What exactly do you mean by power/gpio sequence? I have shown a code and schematic and I described the sequence of actions I do to get the problem. Thanks I will check the article
 

Analog Ground

Joined Apr 24, 2019
460
What exactly do you mean by power/gpio sequence? I have shown a code and schematic and I described the sequence of actions I do to get the problem. Thanks I will check the article
Your right, you did describe the 12V coming on first. Your problem is the 12V through the 12K resistor is injecting current (~1 mA) into your microcontroller and causing mischief. If you have both the micro power and the 12 V on and them turn off the micro power and turn it back on, that would be a false power down problem which might be able to fix with the BOR. In any case, your problem is the current from the 12V supply.
 

Thread Starter

zazas321

Joined Nov 29, 2015
936
Your right, you did describe the 12V coming on first. Your problem is the 12V through the 12K resistor is injecting current (~1 mA) into your microcontroller and causing mischief. If you have both the micro power and the 12 V on and them turn off the micro power and turn it back on, that would be a false power down problem which might be able to fix with the BOR. In any case, your problem is the current from the 12V supply.
Ah I asusmed that could cause a problem but was not too sure.. The problem remains even when i use DC/DC buck/boost converter module to power the sensor/microcontroller so I do not need to use 2 seperate DC power supplies. I just supply 12V to DC/DC converter and output 5V to my microcontroller. ( That was also avoided by swapping GPIO18 to GPIO2)
 

Thread Starter

zazas321

Joined Nov 29, 2015
936
So you have never experienced code that is executing but not doing what you expect it to?

Bob
The board does not output anything even in the serial monitor. Why would it execute code and not do what I expect ( What I programmed it to do)?
 

Thread Starter

zazas321

Joined Nov 29, 2015
936
Another quite strange thing I am noticing with power:

I have 6 seperate ESP32 devices that all connect to the WIFI. All of them use DC/DC boost/buck converter module and everything is fine. I only had 5 DC/DC buck/boost modules at a time so I swapped one with this little guy AMS1117-5
1596776920506.png
1596776976213.png

When I power this device on its own(applying 12V to this DC converter and outpitng 5V) it is able to power ON sucessfully ( starts executing code). However, when I connect this ESP32 with 5 others (the only common connection is 12V and GND), this board is no longer able to power ON properly, I have measured the Vin of the board:20200807_075218.jpg
After enabling 12v, it takes 27ms to reach 5V, could that be the black out problem you were mentioning? Also, when I manually press reset button on the board, it does start!
 

Thread Starter

zazas321

Joined Nov 29, 2015
936
It might be this tiny voltage converter that I am using, but what confuses me is that it works on its own, but when connected to other devices with common 12V and GND it does not work anymore.. Anyway, I read that some people had more sucess avoiding blackouts when powering the board with arround 7V ( apparently 5V not enough?). Also, I cant find any proper information about how to enable the blackout reset? A lot of people talk about blackout problem but not a single example how to implement it
 
Top