ESP32: A Fatal Error

September 1st, 2018

If you get this message when trying to flash an ESP32:

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

You may need to reboot it while flashing so the computer will recognize it. You should be able to trigger a reboot into flashing mode by holding down the BOOT button and giving the EN button a press. Do this while the esptool is “Connecting…”, and it should connect and write with no issues. You may need to try this several times before the tool will see it and connect.

This is what a successful flash looks like:

# make -j flash
Python requirements are satisfied.
Flashing binaries to serial port /COM4 (app at offset 0x10000 )... v2.5.0
Serial port C:/msys32/COM4
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse
MAC: xx:xx:xx:xx:xx:xx
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0220
Compressed 21184 bytes to 12571...
Wrote 21184 bytes (12571 compressed) at 0x00001000 in 1.1 seconds (effective 151.3 kbit/s)...
Hash of data verified.
Compressed 138336 bytes to 68372...
Wrote 138336 bytes (68372 compressed) at 0x00010000 in 6.1 seconds (effective 181.4 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 103...
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 1068.5 kbit/s)...
Hash of data verified.

Hard resetting via RTS pin...

Shift The Graph

February 19th, 2012

I have started working with an Arduino. For someone getting started in electronics, this device, and the community around it make it so much easier to learn. Within two minutes of plugging it in and starting the software, I was able to do something.

Fast forward a bit, this project is the first big project I have taken on. It is a 10 segment bar graph that I wired up, but now, I am moving it’s control from the 10 analog pins to some shift registers. This frees up most of the pins that I needed initially, and doesn’t make control more difficult.

A shift register is like a bucket brigade. Each bucket is one bit on the register, and as you pass it bits, the rest of them get passed one down the line. So, to control which legs of the shift register are powered and which not, I just have to pulse 1’s and 0’s into the register until I get it set the way I want. Since the LED segments are controlled by the shift register legs, they’re set by what is pulsed to the register.

If I want to have an alternating pattern, the registers contain these values
[code] [10101010] -> [10101010]
// Register 1 -> Register 2[/code]

If I were to push one more bit down the line, they would all move one step along.
[code] [01010101] -> [01010101]
// Register 1 -> Register 2[/code]

If I wanted to push the segments to all lit, the register just has to be fed 1’s.
[code] [11111111] -> [11010101]
// Register 1 -> Register 2[/code]

Part List

  • Arduino
  • 10 x 330Ω Resistors
  • 10 Segment LED bar graph or 10 x LED’s
  • 2 x 74LS164N Shift Registers (or any non-164 shift register, your wiring may be different)
  • Wires and Breadboards


  • For this project, I’m not using the reset ability of the 164, so that pin has been tied to V+.
  • There is an Arduino function called shiftOut() that would make this a little easier. I have not used it because I wanted to shift the bits myself to get a better feel for what it was doing.
  • To wire the shift registers to the Arduino, it’s pin 2 on the Arduino to the clock pin (pin 8) on the first or second shift register (since they’re both wired together), and pin 3 Arduino to data pin (pin 1) on the first shift register.

#define DATA 3
#define CLOCK 2

void setup() {
pinMode(DATA, OUTPUT);

for(int i = 0; i < 10; ++i){
digitalWrite(DATA, LOW);
digitalWrite(CLOCK, HIGH);
digitalWrite(CLOCK, LOW);

void loop() {
for(int i = 0; i < 10; ++i){
int hilo = random(0, 2);

case 0: digitalWrite(DATA, LOW); break;
case 1: digitalWrite(DATA, HIGH); break;

digitalWrite(CLOCK, HIGH);
digitalWrite(CLOCK, LOW);

WordPress - Entries (RSS) and Comments (RSS) - © 2011 Ben Dauphinee