Debug ESP32/ESP8266 programs in PlatformIO using the exception decoder

This is the prototype. I think I need to make a PCB for this..

I’ve been hard at work adding RFID abilities to Connected Little Boxes. It’s going mostly OK. It worked first time, which I hate because it means that the pain comes later. And it did, in the form of random crashes. The program would run for a while and then reset with an exception. The ESP devices produce a lump of debug output when they fail, but you then have to decode this text. The great news is that this behaviour is built into PlatformIO, the wonderful tool that I’m using to make the application. All you have to do is add the following line to the platformio.ini file in your project:

monitor_filters = esp8266_exception_decoder

The serial monitor will now look for the messages that mark the start of the debug information and then use the build file to tell you where the program was when it fell over. Very useful. In my case it allowed me to determine that the program was failing in WiFi code, not something that I wrote. Of course, even though it is not failing in my code, I still have to fix it. I have two golden rules when debugging embedded code:

  1. First check the power supply.

  2. Second check the memory allocation.

In this case the power is OK, so the problem must be memory. I thought I had enough free memory for the system keep going but this turned out not to be the case. I freed up a bunch of space and the device has been running solidly ever since.

150 RFID Cards...

I seem to have bought 150 RFID cards. As you do. I’ve been playing with RFID tag stuff for over ten years. The cards I’ve bought aren’t particularly special, but I think they have some internal storage too, which makes them even more interesting. And I do have plans for them. I don’t just spend 25 quid on a whim you know….

First plan is to give one to everyone who comes to the Hull Computer Science 50th Anniversary Celebration in October. I’m going to scatter a few readers around the place and use them to manage the free drinks. We also might have a go at some kind of RFID based Ultimate Werewolf thing.

Second plan is to fit a bunch to the bottom of the HullPixelbot robot arena so that I can fit readers to the robots and they can navigate by reading cards at different positions.

Hmmm. Having thought about it, perhaps I should buy some more…