(SOLVED) Setup don´t run..

Good morning everyone.

I consult you for a problem that drives me crazy ... :confused:
I have done many programs in ESP-01 modules through a CH340G usb adapter without any mishap.

But for a few days, I am unable to execute the VOID SETUP fragment through the serial monitor as in the following example:

void setup ()
{
  delay (1000);
  Serial.begin (115200);
  delay (1000);
  Serial.println (1);
  delay (1000);

}

void loop ()
{
  Serial.println (2);
  delay (1000);

}

The answer I get on the serial monitor is a series of "2", but I never get a "1" to appear previously.

It's like skipping the Setup snippet and going straight to the Loop. This is so put what you put into setup (how to configure the Wi-Fi network and another series of initializations ...)

What I have tried:

-install arduino IDE and install it again
-Update Java
-Try another ESP-01 and another CH340G
-Flash the ESP-01 to origin

  • Uninstall the ESP8266 card in the IDE and install it again. Try older versions (2.6.0 and 2.6.2 instead of the current 2.6.3)

I no longer know where to go or try

Thank you very much for any guidance.

Try this

void setup ()
{
  delay (1000);
  Serial.begin (115200);
  while (!Serial) ;
  delay (1000);
  Serial.println (1);
  delay (1000);
}

What happens if you use the same line speed as the bootloader? Something like 78400(?)

:confused: :confused:

Thanks, but.... don`t work.

I tried this code now:

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);
  delay (5000);
  Serial.begin(57600);
  while (!Serial) ;
  Serial.println(4);
  delay (1000);
}

void loop()
{
  digitalWrite(LED_BUILTIN, HIGH);
  Serial.println(7);
  delay (1000);
}

,with 57600bps for Upload, Serial Monitor and code.

Led blink for 5 seconds >>>> Setup run!

But in serial monitor I only see several "7"; I think is a problem with serial comunication, maybe?

eureka!!!

I solved my little problem...

I need to delay 5 sec. after open the serial monitor. I think my serial converter it's in the end of his life probably...:

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);

  Serial.begin(57600);
delay (5000);

  Serial.println(4);
}

void loop()
{
  digitalWrite(LED_BUILTIN, HIGH);
  Serial.println(7);
  delay (1000);
}

I would wager money that the issue is a quirk of the ESP8266.

ESP8266 has a ton of weird quirks, it's on-board peripherals are.... weird, I think as a consequence of the devices really not being meant as anything other than a really cheap serial gateway - the other features were almost an afterthought to my mind, but then they released the SDK, and people went absolutely crazy with it, and the chip became one of the most popular microcontroller boards by virtue of having native wifi and costing less than a cup of coffee on a breakout board with usb serial adapter - like, it doesn't have some features we take for granted (hardware output compare?! even their I2C implementation is apparently software I2C under the hood, or so I have been told), it will WDT reset itself if you don't yeild control to the wifi hardware. But on the third hand, it's pretty fast, and has truly massive flash options, OTA bootloaders, and that enables a lot of cool stuff.

After the runaway sucess of ESP8266, they did the ESP32, which, looking at the feature list, was designed in large part by looking at what people wished the ESP8266 would do. Dual core to offload the wifi tasks to, much better peripherals... even option for PSRAM to make a near infinite amount (of somewhat slower, because it has to go out on SPI to get it) ram!