ESP8266 FAQ

This page collects esp8266 FAQ

Overview

This document mainly introduces some common problems of developers in the development of ESP8266. These problems mainly include the following categories:

The following are specific questions and answers for each category.

ESP8266 is a high-performance wireless SOC that integrates the industry-leading Tensilica L106 ultra-low-power 32-bit micro MCU in a small package with a 16-bit compact mode, the main frequency supports 80 MHz and 160 MHz, supports RTOS, and integrates Wi -Fi MAC/BB/RF/PA/LNA, onboard antenna. Support standard IEEE802.11 b/g/n protocol, complete TCP/IP protocol stack.

  ESP01~ESP14 are ESP8266 series modules developed and produced by Shenzhen Anxinke Technology. Based on the ESP8266 chip, the layout of peripheral components and the optimized antenna are improved.

   AiCloud is a free server that Anxin can provide to our customers. The data is naked, UDP transmission, simple and stable, and contains many routines and PC-side host computer debugging tools.

   Espressif is a chip manufacturer of ESP8266, and Essence is a manufacturer that produces modules based on ESP8266 and provides a series of development solutions.

  This is determined according to your needs. If you only need a local area network to meet the product needs, then no server is needed, and ESP8266 can also be used for development.

  An Xinke official Taobao shop: https://shop.ai-thinker.com/

The difference between the module hardware is mainly the difference in packaging and the difference in flash size, you can check ESP8266 selection list, if you have any questions, please contact Our sales staff.

    SDK method:
    Advantage: Minimize system cost and volume
     Disadvantages: novices need a week to half a month to familiarize themselves with the code study

    AT method:
    Advantage: You only need to know a few AT commands to realize network communication with an external microcontroller! The development speed is fast.
     Disadvantage: Increased external CPU cost

   You can use this to evaluate which plan is suitable for you

  Because FreeRTOS was opened later, it is generally NONOS
   If you have developed FreeRTOS before, then you can directly use the SDK of the FreeRTOS solution, and this method will help you use the ESP32 series later

  If you are an enterprise user, we will appoint an engineer to be responsible for the connection of your company;
  If you are an individual user, you can post in the forum or send an email to support@aithinker.com, and we will also have a dedicated engineer to handle it.

* Why does the transparent transmission cause packet loss?

Because there is no hardware flow control. If you need to avoid packet loss, set hardware flow control. The transparent transmission function uses the TCP protocol, and each packet of data is 1460 (depending on the protocol stack). As long as the network is good and the buffer space is not consumed, data can be continuously transmitted. For transparent transmission. If the interval between the data received by the serial port exceeds 20ms, it will be deemed to have been accepted, and the received data will be transmitted to the network. If the network is not good, some data may be lost. Therefore, in order to avoid this situation, the serial port can be set to flow control mode.

* Can ESP8266 use AP+STA at the same time?

ESP8266 can use AP+STA mode at the same time (but not as a WiFi amplifier).

* Can ESP8266 perform low power consumption?

ESP8266 can perform low power consumption. AT instruction for low power consumption description:

 Set sleep mode, sleep only takes effect in single STA mode, and works in modem-sleep mode by default.
 AT+SLEEP=0 0 means sleep mode is prohibited
              1 is light-sleep mode, power consumption 0.9mA
              2 is modem-sleep mode, power consumption 15mA

* Save the established TCP Server connection to flash via AT command?

* How ​​to make ESP8266 connect to AP quickly after power on?

Peripheral

*Does SDIO support SD cards?

  ESP8266 is SDIO Slave and does not support SD card.

*How ​​many UARTs does ESP8266 have?

  ESP8266 has two UARTs, UARTO has TX and RX, which can be used for data transmission; UART1 because the RX pin is occupied by SPI-Flash, only TX can be used, which can be used for serial debugging information printing.

*Can GPIO be directly connected to 5V?

   No. GPIO can only withstand 3.6V. It needs to go through a step-down circuit, otherwise it will cause GPIO damage.

Hardware

*ESP8266 voltage and current requirements?

   The voltage range of the digital part of ESP8266 is 1.8V ~ 3.3V, and the operating voltage of the analog part is 3.0V ~ 3.6V, with a minimum of 2.7V.

The peak value of analog power is 350 mA, and the peak value of digital power is 200 mA.

Note: The selected SPI Flash operating voltage also needs to match the GPIO voltage. CHIP_EN still works at 3.0-3.6V, and you need to pay attention to level conversion when using 1.8V GPIO control.

*What issues should be paid attention to when designing the power supply of ESP8266?

   Please pay attention to the following points: “1.” If using LDO transformer, please make sure that the input voltage and output voltage are large enough. 2. The power rail decoupling capacitor must be placed close to the ESP8266, and the equivalent resistance must be low enough. 3. ESP8266 cannot be directly connected to 5V voltage. 4. If ESP8266 is powered by DC-DC, an LC filter circuit must be added if necessary.

*ESP8266 has a large current when it is powered on. What is the reason?

   The RF and digital circuits of ESP8266 have a high degree of integration. After power-on, RF self-calibration will require a large current. The maximum limit circuit of the analog circuit may reach 500 mA; the maximum current of the digital circuit may reach 200 mA. For general operation, the average current is about 100 mA. Therefore, ESP8266 needs to be powered up to 500 mA, which can guarantee that there will be no instantaneous voltage drop.

*Can I use lithium batteries or 2 AA button batteries to directly power ESP8266?

   2 AA button batteries can power ESP8266. The voltage drop when the lithium battery is discharged is relatively large, and it is not suitable for directly supplying power to the ESP8266. The RF circuit of ESP8266 is affected by temperature and voltage fluctuations. It is not recommended to directly power the ESP8266 without any calibration power supply. Recommended use DC-DC or LDO to power ESP8266.

*What is the structure of RAM used in ESP8266?

The total RAM of ESP8266 is 160 KB.

TheIRAM space is 64 KB: The first 32 KB is used as IRAM to store the code without ICACHE_FLASH_ATTR, that is, the .text section, which will be loaded into IRAM from the BIN in SPI Flash through ROM code or secondary boot. The last 32 KB is mapped as iCache, and the code placed in SPI Flash with ICACHE_FLASH_ATTR added will be automatically and dynamically loaded from SPI Flash to iCache.

DRAM space is 96 KB: For Non-OS_SDK, the first 80 KB is used to store .data/.bss/.rodata/heap, the size of the heap area depends on the size of .data/.bss/.rodata; there is also 16 KB for ROM code use. For RTOS_SDK, 96 KB is used to store .data/.bss/.rodata/heap, and the size of the heap area depends on the size of .data/.bss/.rodata.

*The routing configuration is correct, but the route cannot be found and the connection fails, why?

If the SSID and password are configured correctly, there are two possible reasons.

1. It is recommended to use English characters instead of Chinese.

2. Need to pay attention to the setting of bssid_set, if you do not need to specify the MAC address of the route, then you need to configure stationConf.bssid_set = 0.

* What happens to the network disconnection or packet loss in ESP8266 SoftAP + Station mode?

Although ESP8266 supports SoftAP + Station coexistence mode, ESP8266 actually only has one hardware channel. Therefore, in the SoftAP + Station mode, ESP8266 SoftAP will dynamically adjust the channel value to be consistent with ESP8266 Station. This limitation will cause some behavioral inconveniences in ESP8266 SoftAP + Station mode. Users should pay attention. E.g:

``Situation One If ESP8266 Station is connected to a router (assuming the channel number of the router is 6); Set ESP8266 SoftAP through the interface wifi_softap_set_config; If the setting value is legal and valid, the API will return true, but the channel number will still be automatically adjusted to be consistent with the ESP8266 Station interface. In this example, the channel number is 6. ``Situation Two Call the interface wifi_softap_set_config to set ESP8266 SoftAP (for example, the channel number is 5); Connect other stations to ESP8266 SoftAP; Connect ESP8266 Station to the router (assuming the channel number of the router is 6); ESP8266 SoftAP will automatically adjust the channel number to be consistent with ESP8266 Station (channel 6); Due to the channel change, the Wi-Fi connection of the Station previously connected to the ESP8266 SoftAP is disconnected.

``Situation Three Other stations establish a connection with ESP8266 SoftAP; If ESP8266 Station keeps trying to scan or connect to a certain route, it may cause the ESP8266 SoftAP end connection to be disconnected, or UDP packet loss, ping packet loss, etc. Because ESP8266 Station will traverse each channel to find the target route, it means that ESP8266 is actually switching channels, and the channel of ESP8266 SoftAP is also constantly changing. This may cause the original connection of ESP8266 SoftAP end to be disconnected, or UDP packet loss, ping packet loss, etc. In this case, the user can set the timer and call wifi_station_disconnect after the timeout to stop the ESP8266 Station from trying to connect to the route continuously; or during the initial configuration, call wifi_station_set_reconnect_policy and wifi_station_set_auto_connect to prohibit the ESP8266 Station from trying to reconnect the route. *What is the Wi-Fi channel? Can I choose the channel myself? The channel refers to the band of a specific frequency in the designated frequency band used by Wi-Fi. The number of channels used in different countries is different. You can refer to ESP8266 Wi-Fi channel selection guide. ==== Application ==== *Why do cloud upgrades require 2 “bin” files? What is the difference between “user1.bin” and “user2.bin”?    user1.bin and user2.bin are two different BIN files. When generating user1.bin and user2.bin, the same Flash and boot settings must be used to ensure a successful OTA upgrade. The two BIN files are complementary. When running user1.bin, the upgrade is to download user2.bin; when running user2.bin, the upgrade is to download user1.bin. This can ensure that the device can still operate normally if there is a disconnection during the upgrade process. =====Firmware compilation and debugging related===== * Import project considerations Be careful not to have spaces and Chinese characters when importing the project file, for example: C:\Users\Administrator\Desktop\sdk\esp_iot_sdk_v1.3.0 * Why does the LED light of the esp8266 module go out after a flash when it is powered on?   “A,”Because the LED of the esp8266 module is connected to GPIO2, and this IO is shared with UART1_TX, the module will output the print information at this time, so the LED will flash until the print information is output, and the LED will be off.   B,'' If you want to view the content of the startup information, please select the baud rate of the serial debugging assistant 74880. On the hardware, pull down rst and then high to view the startup information.

  “C,”If you want to send AT commands through the serial debugging assistant, please switch the baud rate to 115200.

* ESP8266 boot information description?

* The module does not respond to AT commands?

a. Please select 74880 baud rate, look at the startup log, pull the RST reset pin low and then high, you can use the “Anxinke serial debugging assistant” to view, aithinker_serial_tool_v1.2.3.7z

b. Whether to enter the flash startup mode, GPIO15 pull-down, GPIO0, GPIO2 pull-up?

c. Has the firmware been burned? Is the flash size of the burning configuration consistent with the flash of the WiFi module?

* How ​​to block power-on printing?

U0TXD has system printing by default when it is powered on. For sensitive applications, the internal pin swap function of UART can be used to call the system_uart_swap function during initialization. Set U0TXD and U0RXD to U0RTS (MTDO/GPIO15), U0CTS (MTCK/GPIO13) exchange to shield the power-on system printing. After the exchange, the download pins on the hardware still use U0TXD + U0RXD. When communicating, you need to connect MTDO to the RXD of the MCU and MTCK to the TXD of the MCU.

* How ​​to configure to print log using UART1?

UART1 has only TX function, and can be used to print log when UART0 is used for communication. The reference code is as follows:

           void ICACHE_FLASH_ATTR uart_init_new(void)
           {
          // Wait for FIFOs to be emptied
            UART_WaitTxFifoEmpty(UART0);
            UART_WaitTxFifoEmpty(UART1);
            // Configure UART settings
            UART_ConfigTypeDef uart_config;
            uart_config.baud_rate = BIT_RATE_74880;
            uart_config.data_bits = UART_WordLength_8b;
            uart_config.parity = USART_Parity_None;
            uart_config.stop_bits = USART_StopBits_1
            uart_config.flow_ctrl = USART_HardwareFlowControl_None;
            uart_config.UART_RxFlowThresh = 120;
            uart_config.UART_InverseMask = UART_None_Inverse;
            UART_ParamConfig(UART0, &uart_config);
            UART_IntrConfTypeDef uart_intr;
            uart_intr.UART_IntrEnMask = UART_RXFIFO_TOUT_INT_ENA | UART_FRM_ERR_INT_ENA | UART_RXFIFO_FULL_INT_ENA;
            uart_intr.UART_RX_FifoFullIntrThresh = 100;
            uart_intr.UART_RX_TimeOutIntrThresh = 2;
            uart_intr.UART_TX_FifoEmptyIntrThresh = 20;
            UART_IntrConfig(UART0, &uart_intr);
            // Set UART1 for printing
            UART_SetPrintPort(UART1);
            // Register interrupt handler
            UART_intr_handler_register(uart0_rx_intr_handler);
            ETS_UART_INTR_ENABLE();
           }

* Why the output is garbled when power on?

It is normal to output garbled codes after power-on, because the external crystal oscillator is 26M, please select 74880 baud rate, “press the reset button or pull the RST pin low and then high”, you can see the startup information. You can use “Aithinker Serial Debug Assistant” to view, aithinker_serial_tool_v1.2.3.7z

* Why does the “irom0_0_seg” error occur when compiling the SDK?

ESP8266 FAQ

Restart instructions and program crash reasons