ESP8266 stopped working

Hi, for the past few days, I’ve been improving/updating the program for the ESP8266. As a result, I’ve been installing a new version on the device frequently, usually wirelessly. After a while, the device seemed to stop starting. When I connect the power, the blue LED blinks 11 times. When I connect the cable and download the logs, I see some gibberish in them:

[11:55:02]h��k�H��)�_�V� !J�����^���s(��[I][wifi:313]: WiFi Connecting to my_wifi

Then, there is information about the found WiFi networks.
I tried using the RESET button and uploaded different programs via the USB cable. It looks like memory issues or garbage. Do you think the device is trash, or can it be saved?
This is a Wemos D1 mini board


esp8266:
  board: esp01_1m

It all depends on how valuable your time is and how much you value learning.

If you spend time on it, you will learn things and you might get it back to working (or not).

If you value your time more than a little, buy a new one. That will be cheaper than the time you will likely waste trying to get this one to work again.

If you value learning, it will be worth the time you spend, since it will all lead to learning. Perhaps it will be things you never knew you wanted to learn or it could be things you would have rather not learned.

I would start at ground zero with the most basic “hello world” program, no WiFi nothing exotic, just hello world on the serial port and work from there, but only if you value learning.

Thank you for your response (nicely said). Yes, I treat the entire Home Assistant installation as a hobby and for the purpose of gaining new knowledge. Of course, it’s not about the costs. I have already ordered 5 new boards, but I really don’t like throwing away things that can be repaired. I am against the idea of planned obsolescence.

Do you mean something like in the code below?

esphome:
  name: hello_world
  platform: ESP8266
  board: esp01_1m

logger:

api:

ota:

text_sensor:
  - platform: template
    name: "Hello World"
    lambda: |-
      return {"Hello World"};

What a surprise: the ordered boards arrived today. I immediately took one and uploaded the program to it, and guess what: the same problem. So it’s my mistake in the code. So I followed your lead and uploaded the simplest configuration as for a new device. The board came back to life.
Then I pasted the code piece by piece and uploaded it to the board each time. It turned out that after adding the last part, the problems started again. However, the compiler first mentioned that there was not enough memory. Does this mean that my code is too long (175 lines)

This is why it is important to pay attention to what the tools are saying. If the compiler says you are out of memory that is generally a bad thing.

It probably isn’t the length of the program, but rather what it is doing. You must have some large data structures there.

Is there a reason to define board: esp01_1m if you are using d1_mini?
I have never used esp01_1m with esphome and I don’t know the behavior when you define 1mb board with restricted pinout while using 4mb dev board, but it simply doesn’t make sense to me…

I never thought about it. After connecting the board via USB and adding it to the ESPHome Builder, it always had the default configuration. I thought that was how the board was detected. Maybe it’s some kind of Wemos clone?

board: d1_mini
should work (and define 4mb flash).

Before the ESP chip starts executing the program in flash, it typically communicates at a baud rate of 74880. This is the default baud rate used by the ROM bootloader during the initial stages of booting up. Early in the execution of the program the baud rate is set to whatever you put in the configuration file. Usually, 115200. If you want to see what’s there, change your terminal program bit rate to 74880.

The main difference from board: d1_mini and board: esp01_m are the pin differences and flash size. (Definitions file).

In summary:

BOARDS = {
    "d1_mini_lite": {
        "name": "WeMos D1 mini Lite",
        "flash_size": FLASH_SIZE_1_MB,
    },
    "d1_mini": {
        "name": "WeMos D1 R2 and mini",
        "flash_size": FLASH_SIZE_4_MB,
    },
    "d1_mini_pro": {
        "name": "WeMos D1 mini Pro",
        "flash_size": FLASH_SIZE_16_MB,
    },
    "esp01_1m": {
        "name": "Espressif Generic ESP8266 ESP-01 1M",
        "flash_size": FLASH_SIZE_1_MB,
    },
    "esp01": {
        "name": "Espressif Generic ESP8266 ESP-01 512k",
        "flash_size": FLASH_SIZE_512_KB,

After defining the board as d1_mini, the hardware shows 4MB Flash, but the amounts displayed indicate that it is actually 1MB (see attachment). Should I declare the amount of memory somewhere else? By the way: a proper COM connection can be obtained at a speed of 115200. At a speed of 74880, the information is unreadable.

No

Still issue like that?

Memory in microcontrollers like the esp8266 is a little complicated. The maximum program size is 1 MByte. If you have 4 MBytes of flash you have 3MB that can’t be used for standard program memory, but can be used for a file system. Note that program memory in this case means memory used to store the program and NOT the program’s variables which generally require RAM which is much less.

This is a decent explanation of the weird baud rate of the bootloader: The ESP8266

Most people either know about this weirdness or just ignore the weird data they get after a reset. Sometimes this weirdness confuses terminal programs, so multiple resets can be necessary to get a good output.