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 )...
esptool.py v2.5.0
Serial port C:/msys32/COM4
Connecting........_
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.

Leaving...
Hard resetting via RTS pin...

Javascript Element Properties From Object

December 19th, 2013

How to create a HTML tag, using an object of properties.

[code]$(‘#somediv’).append($(‘<a/>’, {href: ‘#’, id: ‘dothing’, text: ‘Do Thing’}));[/code]

PHP Class To Color CLI Output

July 31st, 2013

A guy named JR posted this nifty piece of code to help color CLI output in bash from PHP scripts

And this user on GitHub cleaned it up a bit and posted a Gist of it.

Which Framework?

July 21st, 2013

Learning a framework is an investment of time. You have to work out how this one structures its files, wants you to template, what levers to pull.

This is why people build their own so often. At least then it works the way you want it to.

composer pain.json

July 15th, 2013

So tonight I decided to try and use Composer, a “dependency management” tool for PHP. I’ve had my eye on doing this for a while, and finally got to it tonight.

I use a custom rolled version of PHP 5.5, because I want to actually use the new functionality that PHP has finally added. So, on to the install I went.

curl -sS https://getcomposer.org/installer | php

Already, the first critique here, I’m downloading a file and piping it right on into PHP. I’m not going to go into that, because this guy already has. So, on to the next step, after I took a quick poke through the installer code I downloaded.

Woops, need to recompile my PHP binary without --disable-phar. Now, done that, I ran the installer again, and had a clean install this time.

Next step, create a composer.json file after running through the Composer install steps. I wanted to use Zend Framework, so I copied the snippets of composer JSON from this site and assembled them into a coherent composer file (not the easiest thing, since the Composer manual didn’t seem to have a nice example file linked somewhere that I could find).

My basic composer.json file:
[code]
{
"repositories": [
{
"type": "composer",
"url": "https://packages.zendframework.com/"
}
],
"require": {
"zendframework/zend-config": "2.*"
}
}
[/code]

Next, ran a composer validate composer.json on my file, and got this output:
composer.json is valid for simple usage with composer but has strict errors that make it unable to be published as a package:
See http://getcomposer.org/doc/04-schema.md for details on the schema
name : is missing and it is required
description : is missing and it is required
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.

After a quick look over the messages, I decided to soldier on anyway, crossed my fingers, and ran composer install.

The installer seemed to laugh at me after it downloaded the files, and told me that I needed to --enable-zip before I could install the packages. THANK YOU COMPOSER, for mentioning that on install.

Another recompile, and finally I managed to get Composer to behave.

Lessons Learned

  • Composer needs both PHAR and Zip enabled to work, but doesn’t like to mention those things
  • Custom PHP is fun to do, but can be a pain when you need to turn things on that you didn’t plan on using
WordPress - Entries (RSS) and Comments (RSS) - © 2011 Ben Dauphinee