Need help flashing blink with arduino

I’m stuck at step zero flashing the microcontroller. I am trying to upload the ESP8266 Blink sketch.
Can anyone help narrow down the list of tests and variables to try and get this project moving?

My computer and the microcontroller (MC) are trying to communicate, but aren’t quite there.
When arduino is trying to connect to the MC, the MC blinks rhythmically while arduino shows a slow progress bar. At the end I get an error saying : esptool.FatalError: Failed to connect to ESP8266: Invalid head of packet (0x00)
I ordered two kits and both MCs behave the same way.
I have not started any soldering, so the MCs are right out of the mylar envelope.

My computer recognizes the USB serial adapter: QinHeng Electronics HL-340 USB-Serial adapter.
When I don’t point arduino at the correct USB port it errors out differently, indicating it can’t find the device at all.
I have used several different USB cables and they all give the same results.
I have used different USB ports on my computer and I get the same results.

Arduino 1.8.16 installed and running
http://arduino.esp8266.com/stable/package_esp8266com_index.json additional board manager linked Board manager esp8266 community 3.0.2 installed
I have tried many different boards and many different upload speeds, though I have not systematically gone through all the available combinations of boards and speeds.

I’m looking for recommendations for what to try next.
Any help appreciated,
derek

Hi Derek,

I’ve previously had some problems with Blink, and that’s documented in this post:
Wemos is not recognised - Flashing of the Wemos D1 Mini - AirGradient

What board have you told the IDE you’re programming? I chose this option:
image


- Greig.

Greig,
I’ve tried many of the boards in the ESP8266 Boards (3.0.2) list. Here is the output when I try the LOLIN(WEMOS) D1 R2 & mini as recommended: I hope it uploads an image…


And here should be an image of the settings from the tools menu:

Any ideas?
thanks,
derek

Have you installed the driver? That gave me some head scratches while trying to flash mine…
https://www.wemos.cc/en/latest/ch340_driver.html

I just updated? my drivers. I followed the sparkfun tutorial here:
https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all#linux

The drivers did change from “ch341” to “ch34x”, and everything so far works like before. I am getting the same results as before where the devices fail to connect. I’ll go back to cycling through usb cables and upload speeds tomorrow.

I suspect I may be having issues with missing python dependencies. I tried some updates, however the problem may be more systemic than that. It will take me a while to remedy this. Meanwhile if anyone has any more helpful suggestions I’d love to try anything more simple than replacing my whole OS.

Thanks,
derek

Hi Derek,

What’s your OS? I notice from one of your screen-grabs that the port is /dev/ttyUSB0.

All of my experience with the Arduino app/IDE is under Windows…

-G.

Greig,
I’m running a flavor of Linux. It will take me a while to redo my computer, so I will try to commandeer a different computer in the house to see if Arduino is more self contained on another OS.

It will take me a while, however I will report back with results.

Ok, using windows I was able to upload the blink sketch. Step 0 complete. Now to flash the project code and warm up the soldering iron. For reference, below are the settings that were successful. I had to slow down the data rate until it worked. I’ll also bump this thread with an update when I get the Arduino part working on a Linux box. Thanks all!

I’m having the same problem here.

Just noting that I’ve tested upload blink to another board I have here with success (Wemos D1 Mini ESP32).

I’m getting the error “Timed out waiting for packet content” and sometimes “Invalid head of packet (0x01)”

Tried another USB cable, lowering the flash speed.

I don’t know what to do.

Edit:
Just added pictures of the board. I even disconnected the PM2.5 cable for trying to flash it.


jairbj,
Try lowering speed two more notches to 256k. Maybe even lower?

After I got blink to work, I had to install a few more header files to get he airgradient software to compile (it looks like you made it past this part). Then I hit the packet timeout again. Reducing the speed worked and I stopped investigating. Me not being a programmer is difficult, because I feel like I’m stabbing at the dark until something starts working.
I wish you the best of luck and success,
derek

Hi derek, I tried every speed on that screen (even 56k). And no success. I think I’ll desolder it from the board and try again.

@jairbj
Can you try the following.

After you hit uploading and you see “connecting…connecting” in the console, press the Reset button on the D1 mini.

@Achim_AirGradient

I’ve already tried it.

When doing so I usually get “Connecting …” and after a while “Invalid head of packet (0x01)”.

@jairbj
Another thing you could try is under “erase flash” to reflash all and not only the sketch.

@Achim_AirGradient, tried what you suggested but got the same error. Tried it with all flashing speeds more than once and also pressed the reset button.

@Achim_AirGradient I removed it from the board and still can’t flash it.

Any suggestions?

I could see two things:

a) The D1 is broken
b) Sometimes the USB drivers on the Wemos D1 are fiddly and it could make sense to try and flash it on a completely different computer. What OS do you currently use?

I’m currently using Windows 11.

As I told you, I’ve flashed a D1 ESP32 at the same machine/os/cable/usb port.

Today earlier I bought more two D1 Mini for testing. Just need to wait for it to arrive.

@jairbj

Not all D1 minis are exactly the same.
The D1s use slightly different USB chips across the range and I had some that were tricky to flash and get the driver installed.