Mac LCD

Information for using small character LCDs such as the HD44780 with Mac OS X, LCDproc and Growl. And other Apple and Mac USB stuff.

Friday, February 23, 2018

ESP32 first timer

I have been messing around with a Wemos Lolin32 ESP32 module that I recently bought on ebay for a few bucks. I'm not totally sure what I am going to do with it yet, but it looks awesome for easy IoT home automation. I have had some early successes after some difficulty so I wanted to share my methods and results on Mac OS x.

Unfortunately, the Lolin32 module I bought was not pre-loaded with the AT command interpreter that seems to be standard. I ended up with 2 different ESP32 boards from separate ebay sellers which seem to be pre-loaded with only a simple test program. The manufacturer of both of them seems to be "TTGO". Anyway, it is definitely something to be aware of if you don't want to be doing a lot of programming and flashing just to get the AT command interpreter for an internet modem. Fortunately, Espressif Systems, the company that manufactures the ESP32, has done an excellent job of providing development tools and open sourced software for the chip. It is nice to see great macOS support from this company. Most Chinese manufacturers seem to focus on Windows only and maybe Linux.

Things you need to install for building and testing the AT command terminal:

If you have the CJMCU FT232H (or FTDI UM232H(-B), or Adafruit FT232H breakout), like I am using on my Apple II Disk emulator, connect it to the ESP32 module like this (we don't really need CTS/RTS yet, though):

ESP32 signalESP32 GPIO# (Lolin32 labels)FT232H (CJMCU labels)
RX16AD0
TX17AD1
RTS14AD2
CTS15AD3

Follow the instructions for flashing the AT command firmware. Basically: git clone --recursive https://github.com/espressif/esp32-at.git $ cd esp32-at $ make menuconfig In the menu that appears, set:

  • Serial flasher config
    • Default serial port to:
    • /dev/cu.SLAB_USBtoUART
$ make $ make factory_bin $ make erase_flash $ make flash

Along the way, you may get errors about some python modules that are missing. To resolve these, just install the listed package...
$ sudo pip install pyyaml xlrd
... and re-run the command with the error.

The first time I ran everything, I was getting brown-out errors in the debug console. I changed USB cables and did not have any further power problems.

The biggest issue I had was actually communicating with the AT command terminal using the "screen" command in macOS. No matter what I typed, the ESP32 would echo, but not respond. The basic problem had to do with line endings. Using miniterm.py rather than screen solved the problem, but a adding bindkey "\015" stuff "\015\012" to the ~/.screenrc file also worked. I couldn't get the stty screen commands like onlret or onlcr to work correctly.

Or, you can configure the ESP32 to use <CR> line ending, like it should have:

$ make menuconfig
  • Component config
    • AT
      • enable: AT command terminator support.
      • set :AT command terminator. to:
      • 0x0D

Once everything is connected and built, you can connect to the device with:
$ screen /dev/cu.usbserial 115200,cs8,-parenb,-cstopb
or:
$ miniterm.py /dev/cu.usbserial 115200
Of course, you may need to add a numeric extension after "cu.usbserial", depending in what is in your /dev/ folder.

Quick ESP32 AT Trouble-Shooting Guide
IssueLikely CauseSolution
Garbage characters received from ESP32Incorrect Baud rateset terminal baud rate to 115200, or the same rate specified in make menuconfig.
Typed characters do not appear in terminalIncorrect RX/TX connectionsverify that wires to ESP32 UART1 are not crossed and have continuity
Typed characters appear in terminal, but no response from ESP32Incorrect line endings from terminalUse miniterm.py, or modify ESP32 settings with make menuconfig, or modify screen bindkey settings in ~/.screenrc
Typed characters appear in terminal, but still no response from ESP32ESP32 is hung from previous incorrect line endingsReset ESP32

So, after all of that I am to the standard default set-up that most people get already installed.

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home