Connecting to the ESP8266
Total Page:16
File Type:pdf, Size:1020Kb
Page 1 Table of Contents Introduction................................................................................................................................26 Overview....................................................................................................................................27 The ESP8266........................................................................................................................28 The ESP32............................................................................................................................29 Maturity.................................................................................................................................29 The ESP8266 specification...................................................................................................30 The ESP32 specification.......................................................................................................30 ESP8266 Modules.................................................................................................................31 ESP-12.............................................................................................................................31 ESP-1...............................................................................................................................35 Adafruit HUZZAH..............................................................................................................41 NodeMCU devKit..............................................................................................................41 node.IT (aka ESP-210).....................................................................................................43 SparkFun WiFi Shield – ESP8266....................................................................................43 Espresso Lite....................................................................................................................44 Wemos D1........................................................................................................................44 Oak by digistump..............................................................................................................44 ESP32 Modules.....................................................................................................................44 ESP32-DevKitC................................................................................................................45 Connecting to the ESP8266.......................................................................................................47 WiFi Theory...............................................................................................................................48 AT Command Programming.......................................................................................................50 Commands............................................................................................................................51 Installing the latest AT command processor..........................................................................56 Assembling circuits....................................................................................................................57 USB to UART converters.......................................................................................................57 Breadboards..........................................................................................................................59 Power....................................................................................................................................60 Multi-meter / Logic probe / Logic Analyzer.............................................................................61 Sundry components..............................................................................................................61 Physical construction.............................................................................................................61 Recommended setup for programming ESP8266.................................................................61 Configuration for flashing the device.....................................................................................64 Programming.............................................................................................................................65 Boot mode.............................................................................................................................65 ESP8266 – Software Development Kit (SDK).......................................................................66 Include directories.............................................................................................................66 ESP32 – Espressif IoT Development framework...................................................................67 How IDF works.................................................................................................................70 Error handling...................................................................................................................72 Page 2 The build environment menu configuration.......................................................................72 Creating a build environment of the Raspberry Pi 3..........................................................75 Compiling..............................................................................................................................77 ESP32 – Compilation........................................................................................................84 ESP32 – Flashing.............................................................................................................86 Loading a program into the ESP8266...............................................................................87 Programming environments..............................................................................................91 Compilation tools..............................................................................................................91 ar..................................................................................................................................91 esptool.py.....................................................................................................................91 esptool-ck.....................................................................................................................93 gcc...............................................................................................................................96 gen_appbin.py..............................................................................................................97 make............................................................................................................................98 nodemcu-flasher..........................................................................................................98 nm..............................................................................................................................100 objcopy.......................................................................................................................100 objdump.....................................................................................................................100 xxd.............................................................................................................................100 ESP8266 Linking.................................................................................................................101 ESP32 Linking.....................................................................................................................102 Flashing over the air – FOTA...............................................................................................105 Debugging...........................................................................................................................109 ESP-IDF logging.............................................................................................................109 Logging to UART1...........................................................................................................110 Run a Blinky....................................................................................................................110 Dumping IP Addresses....................................................................................................112 Exception handling..........................................................................................................112 Using a debugger (GDB).................................................................................................115 Debugging and testing TCP and UDP connections.........................................................115 Android – Socket Protocol..........................................................................................115 Android – UDP Sender/Receiver................................................................................115 Windows – Hercules...................................................................................................116 Curl.............................................................................................................................116 Eclipse – TCP/MON...................................................................................................116