Wednesday, July 25, 2018

Software Challenges to Match My Hardware Frustrations | Errors Flashing an ESP32 Chip

With my hardware woes out of the way, I thought I was home free to build out my custom Trip Timer. Eager to jump in to coding, I did a quick Google search to learn how to program my Huzzah Featherweight chip and found myself back at Adafruit.com.

I carefully walked through the steps of setting up the Arduino IDE and had no problem installing the custom board definitions. It's when I went to push my code to the chip that things started failing. I kept getting messages like: "warning: espcomm_send_command: didn't receive command response" followed by a FLASH_DOWNLOAD_BEGIN fail message.

I Googled around and other folks had this issue, but there was no consensus as to how to fix it. Maybe it was a hardware issue? Maybe the instructions were out of date with the components?

Per the Adafruit instructions, I tried manually connecting to the chip using Putty, but that failed too. Rather than seeing a Lua prompt, I saw nothing but gibberish. After multiple attempts, I tried using the baud rate of 115200 versus the suggested 9600. I finally saw that the chip was scanning for WiFi - proof that the chip wasn't fried. Though it was acting nothing like the instructions I was reading.

Was it possible that the firmware that came with the chip was dramatically newer than the instructions expected? So new in fact, that even the IDE couldn't work with the chip? That didn't make sense.

I continued poking around, even going so far as flashing a new image to the Huzzah. That only made things worse: instead of seeing an intelligent WiFi scanning message when I connected to the chip from Putty, I saw scary looking boot error messages. I'd clearly made things worse.

How could the trivial task of pushing a 'Hello World' program to this chip be turning into such a nightmare?

I don't recall the page that triggered my epiphany, but man, what a moment of clarity. My problem: when I did my initial search for instructions, I came across those intended for the Feather Huzzah ESP8266. From then on, I dug deeper into setting up and running the ESP8266. The problems is, I'd purchased a Feather Huzzah ESP32. Despite the similar sounding names, they are completely different chips, with completely different instructions. I was feeding my German speaking chip Japanese, and it wasn't having it. No wonder everything was broken.

I carefully installed Arduino support for ESP32 chips. This took two attempts: the first time I did it in cygwin, but the installed binaries didn't have the right permissions. I then re-executed the process under Powershell, and it finally worked.

Using this Hello World example, and this connect to a network example, I verified my chip was working just fine.

Next up, I need to figure out how to interact with the screen. You can be sure that I'm going to pay quite a bit more attention to the specifics of that hardware.

Man it feels good to be back on track!

No comments:

Post a Comment