Building Zimodem for ESP-32 with USB console support

If you are using a NodeMCU-32S module like the one I ordered from Amazon:

HiLetgo ESP-WROOM-32 ESP32 ESP-32S Development Board 2.4GHz Dual-Mode WiFi + Bluetooth Dual Cores Microcontroller Processor Integrated with Antenna RF AMP Filter AP STA for Arduino IDE…/B…/ref=cm_sw_r_cp_tai_X5iFAbW6CD3ZJ

…you may want todo a few tweaks to the ZIMODEM. ZIMODEM is setup to build for Tools->Board->NodeMCU-32S.

There are two major differences in building Zimodem for the ESP8266 and the ESP-32:

  1. The ESP-32 ZIMODEM has more functionality. There are multiple serial ports on the module, and more I/O pins. By default, the ESP-32 build will have a separate debug port (the USB console) from the communication (the TX/RX pins it uses). If you want to use the USB terminal for testing, rather than debug output, you can make two quick hacks:
    1. In zmodem.ino at around line 43, disable the debugPrintf as follows:

      //#define debugPrintf Serial.printf
      #define debugPrintf doNothing

      That will make it use the ESP32 code, and disable debug output.

    2. In pet2asc.h, comment out the Hardware Serial port initialization and make it use use the standard Serial port:

      //static HardwareSerial HWSerial(2);
      #define HWSerial Serial

      That will make the HWSerial port be the same one used by the USB console.

There is probably a better way, but this was the first time I got it going.

After that, the build you make will be controllable via USB port or the RS-232 port.

Leave a Reply