This article asks you to understand the ESP chip and development of Lexin Internet of things


What is esp

When it comes to the Internet of things industry, we have to mention the famous Lexin company. Its esp8266 and esp32 series chips are in a mess. If you don’t know these two names, please go back and face the wall for three minutes. In 2015 and 2016, Lexin released esp8266 and esp32 chips respectively, which shocked the Internet of things industry. Why? When the function is enough, the cost is low. Say the important things three times: cheap, cheap, cheap. The cost of the control module of the Internet of things has directly reached about 10 yuan. Now you go to Taobao to see the development board of esp8266 for more than 10 yuan, and the development board of esp32 for about 20 yuan. So what did you buy for the 10 more than 20 yuan? Look at the definition of ESP chip: ultra low power 32-bit micro MCU, with 16 bit reduction mode, supports RTOS, integrates wi fimac / BB / RF / PA / LNA, on-board antenna, adopts gagent firmware programming, and can quickly realize equipment M2M access, data statistical analysis, remote control, OTA upgrade, third-party interface and other functional services. The firmware supports SOC solution and secondary development, which greatly reduces the development cost and shortens the development cycle. This is a great benefit for enterprise production and individual DIY, and the whole ecology is gradually improved. I think this is an important achievement of a technology company. It can stir up the ecological changes of the whole industry and promote the progress of the whole industry.

Classification of ESP

  1. ESP chip and its package

    Taking esp8266 as an example, let’s introduce a series of ESP knowledge. ESP products can be divided into three product forms: chip, module and development board. The chip is produced by Lexin, while the module is packaged by the manufacturer and then produced for direct use by users. The development board encapsulates the module again, Lead out the USB port to developers for direct development and use. At present, a large part of Lexin’s modules are manufactured by Anxin OEM. For designers, they can use the development board to complete the function design and development, then select the module or directly use the chip according to the actual needs, and finally design the circuit for the production of the actual product.

    chip modular Development board





    This article asks you to understand the ESP chip and development of Lexin Internet of things This article asks you to understand the ESP chip and development of Lexin Internet of things This article asks you to understand the ESP chip and development of Lexin Internet of things
  2. ESP series

    ESP can be divided into esp8266, esp32, esp32-s and esp-c series according to function and age;

    Esp8266 series Esp32 series Esp-c series Esp32-s series
    32-bit MCU & 2.4 GHz Wi-Fi 32-bit MCU & 2.4 GHz Wi-Fi & Bluetooth/Bluetooth LE 32-bit RISC-V MCU & 2.4 GHz Wi-Fi & Bluetooth 5 (LE) 32-bit MCU & 2.4 GHz Wi-Fi & Bluetooth 5 (LE)
    Single core CPU clock frequency up to 160 MHz

    +19.5 DBM antenna output power to ensure good coverage

    Sleep current less than 20 μ A. Suitable for battery powered wearable electronic devices

    Peripherals include UART, GPIO, I2S, I2C, SDIO, PWM, ADC and SPI
    Two or one CPU core that can be controlled separately, with adjustable clock frequency, ranging from 80 MHz to 240 MHz

    +19.5 DBM antenna output power to ensure good coverage

    Traditional Bluetooth supports L2CAP, SDP, gap, SMP, avdtp, avctp, A2DP (SNK) and AVRCP (CT) protocols

    Low power Bluetooth (Bluetooth LE) supports L2CAP, gap, GATT, SMP, and blufi, spp like protocols above GATT

    Low power Bluetooth connects smart phones and sends low-power beacons for easy detection

    Sleep current less than 5 μ A. Suitable for battery powered wearable electronic devices

    Peripherals include capacitive touch sensor, Hall sensor, SD card interface, Ethernet, high-speed SPI, UART, I2S and I2C
    Single core CPU clock frequency up to 240 MHz

    Support a variety of low-power working states: fine clock gating, dynamic voltage clock frequency regulation

    Security mechanism: eFuse storage, secure startup, flash encryption, digital signature, supporting AES, Sha and RSA algorithms

    Peripherals include 43 GPIO ports, 1 full speed USB OTG interface, SPI, I2S, UART, I2C, led PWM, LCD interface, camera interface, ADC, DAC and touch sensor

    It can connect with rich network cloud platforms and has common product features, which greatly shortens the time of product construction and launch
    Xtensa ® 32-bit lx7 dual core processor with main frequency up to 240 MHz

    Built in 512 KB SRAM, 384 KB ROM storage space, and supports multiple external SPI, dual SPI, Quad SPI, octal SPI, QPI, OPI flash and off chip ram

    44 programmable gpios of vector instructions for accelerating neural network calculation and signal processing are added to support common peripheral interfaces, such as SPI, I2S, I2C, PWM, RMT, ADC, DAC, UART, SD / MMC host controller and twaitm controller

    Flash encryption based on aes-xts algorithm and secure startup based on RSA algorithm, digital signature and HMAC module, “world controller” module
  3. ESP scheme


Development of ESP

  1. Development board

    In fact, it is not necessary to choose the development board on Lexin’s official website. For example, the price of esp8266 devkitc is usually about 40 yuan. For Xiaobai, the two development boards with the highest cost performance in the market are esp12f nodemocu (esp8266) and esp32-d0wdq6 (esp32). Both boards adopt the open source scheme of nodemocu. If the serial port chip of ch340 is selected, The price can be as low as 10 yuan and 20 yuan respectively, which is very cost-effective for hands-on training. I suggest that if esp8266 is not specially designated, I suggest going directly to esp32, which is more convenient for follow-up learning.

  2. development environment

    In addition to C / C + + language, esp can run Lua (nodemcu), JavaScript (espruino) and python (micro Python), which can be said to be very diverse. Today’s development environment is mainly for C + +. Let’s introduce the development environment. First, let’s talk about the tools that can be used to develop IDE, including Arduino, vscode, platform, esclipes, shell, vs, etc. these tools need to be selected from SDK support, personal habits and development system. I mainly introduce the development under windows;

  3. Esp8266 development

    The core SDK of esp8266 is mainly divided into ESP nonos SDK and ESP RTOS SDK. As the name suggests, one is an SDK without system and the other is an SDK based on free RTOS system; With the SDK, configuring the compilation environment requires a tool chain. Lexin also provides an official tool chain package that can be downloaded directly.

    After introducing these, let’s talk about the construction scheme of the whole development environment.

    The simplest way is to select Arduino. You can download and configure the SDK toolkit directly through the Arduino ide. You do not need to download and configure it yourself. It is the most convenient for novices. Moreover, Arduino inherits a rich third-party library and can be downloaded and used directly. Can refer toArduino ide builds esp8266 development environment and project demonstration – brief book (Jianshu. Com)。 Of course, vscode also integrates the Arduino plug-in. You can also try it. After all, the ide of vscode is much easier to use than Arduino.

    The second option is to use the official SDK and tool chain for development, configuration and development. You can refer to the official development. Esclipes development tool is selected on the official website. Of course, vscode can also be selected for configuration development. Please search this by yourself.

    Standard settings of Windows platform tool chain (traditional GNU make) – esp32 – esp-idf programming guide v4.2.1 document (espressif. Com)

    Standard Setup of Toolchain for Windows — ESP8266 RTOS SDK Programming Guide documentation (

    The third scheme is to select vscode + platform for development. Basically, it can also automatically build the development environment like Arduino. It can flexibly configure board (what development board eg. nodemcuv2), framework (what framework eg. Arduino) and platform (what platform eg. espressif8266)Platformio built in nodemocu development environment (esp8266)_ Miracle blog – CSDN blog_ platformioIn fact, platform IO is just a development management tool, and its internal implementation is inseparable from the native SDK and Arduino suite. You can study the things in the framework and package yourself.

    I have tried the above three methods for esp8266, but each has some defects. In fact, I most want to use vscode + platform in IDE and Arduino + FreeRTOS in framework, because Arduino has rich development resources, but the esp8266 development package of Arduino is based on the SDK of nonos, so I can’t have both fish and bear’s paw, Maybe I’m too OCD. If I get it wrong, you can also point out the development method using FreeRTOS under Arduino.

  4. Esp32 development

    Starting from esp32, the official website has unified the development environment. ESP IDF is used as the development tool, including esp32 API and for operationTool chainScript, etc. I think the most outstanding advantage is that it uses macros internally to control whether to use FreeRTOS system, so that FreeRTOS can be used for development under Arduino. Of course, the official website also says that esp8266 should be integrated into the system, but it has not been implemented yet, so I suggest developers directly go to esp32, which is more selective.

    The simplest is to use Arduino, which is basically the same as the process of esp8266. It’s just to change the address of the development library to esp32, which can be used for referencePlay with esp32 + Arduino (I) development environment construction_ Finedayforu blog – CSDN blog

    The second scheme is vscode + ESP IDF plug-in, which can be referred toespressif/vscode-esp-idf-extension: Visual Studio Code extension for ESP-IDF projects (

    The third scheme is vscode + platform IO plug-in. The installation method is the same as that of esp8266, but the platform is different. There is no reference here.

    The fourth scheme is visual studio + visual GDB plug-in, which can be used for referenceEsp32 builds an esp32 development environment on vs2017 + visual GDB platform

  5. General development

    Of course, don’t forget the development of Python and JS. The official website also gives the development methods. For Python and JS, I think it is very convenient for the upper web development of the Internet of things. You can use Python for web development, while C + + is more suitable for driver and sensor control.

    Micro Python esp32 tutorial – micro Python 1.9.2 documentation (singtown. Com)

    For the development of lua, the personal experience is not very good. If you are interested, you can search for it yourself. It is recommended to use python.