This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:iot-open:espressif_modes [2023/10/06 07:15] – ktokarz | en:iot-open:espressif_modes [2023/11/21 16:29] (current) – removed pczekalski | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | === === | ||
| - | <box # | ||
| - | <box # | ||
| - | === ESP AT Networking === | ||
| - | <box # | ||
| - | <box # | ||
| - | |||
| - | ESP8266 or ESP32 SoC can work as the WiFi communication module for other microcontrollers. To use the ESP8266 or ESP32 chip as a modem (Figure {{ref> | ||
| - | |||
| - | <figure esp_at> | ||
| - | {{ : | ||
| - | < | ||
| - | </ | ||
| - | |||
| - | < | ||
| - | AT commands were developed to control telephony modems. Contemporary they are often used to control modules connected via serial port. This includes GPS receivers, GSM/LTE modems, network modules and others. | ||
| - | </ | ||
| - | |||
| - | == Download Software== | ||
| - | |||
| - | * Download the latest ESP Flash Download Tool (v3.9.5 at the time of writing) from ((https:// | ||
| - | |||
| - | There are also other flashing tools like NodeMcu Flasher ((https:// | ||
| - | |||
| - | * Download the latest AT release from ((https:// | ||
| - | The newest version of Espressif firmware is not compatible with ESP8266 SoCs. In the case of using ESP8266-based boards, download older AiThinker firmware available on GitHub ((http:// | ||
| - | The firmware can come in different versions. It can be a set of binary files which must be uploaded at specific memory addresses or as a combined single binary file. Note, that a single file is prepared for a specific flash memory size. | ||
| - | |||
| - | ==Flashing Procedure with single binary file== | ||
| - | * Detect ESP8266 module parameters. Start the ESP Flash Download Tool (" | ||
| - | |||
| - | <figure AT_flash> | ||
| - | {{ : | ||
| - | < | ||
| - | </ | ||
| - | |||
| - | * Gather information. Make a note of the flash memory size. In this example, we have a 32 Mbit flash. | ||
| - | * Load the correct size of the combined AT binary firmware file (" | ||
| - | |||
| - | <figure AT_load> | ||
| - | {{ : | ||
| - | < | ||
| - | </ | ||
| - | * Then, click the START button and wait until the flashing process is over. | ||
| - | |||
| - | ==Flashing Procedure with a set of separate files== | ||
| - | To flash the firmware from a set of files, or to restore the original firmware: | ||
| - | * Detect ESP8266 module parameters. Start the ESP Flash Download Tool (" | ||
| - | |||
| - | <figure AT_flash1> | ||
| - | {{ : | ||
| - | < | ||
| - | </ | ||
| - | * From the downloaded AT firmware folder, open the " | ||
| - | < | ||
| - | # BOOT MODE | ||
| - | ## download | ||
| - | ### Flash size 8Mbit: 512KB+512KB | ||
| - | boot_v1.2+.bin | ||
| - | user1.1024.new.2.bin | ||
| - | esp_init_data_default.bin | ||
| - | blank.bin | ||
| - | |||
| - | ### Flash size 16Mbit: 512KB+512KB | ||
| - | boot_v1.5.bin | ||
| - | user1.1024.new.2.bin | ||
| - | esp_init_data_default.bin | ||
| - | blank.bin | ||
| - | |||
| - | ### Flash size 16Mbit-C1: 1024KB+1024KB | ||
| - | boot_v1.2+.bin | ||
| - | user1.2048.new.5.bin | ||
| - | esp_init_data_default.bin | ||
| - | blank.bin | ||
| - | |||
| - | ### Flash size 32Mbit: 512KB+512KB | ||
| - | boot_v1.2+.bin | ||
| - | user1.1024.new.2.bin | ||
| - | esp_init_data_default.bin | ||
| - | blank.bin | ||
| - | |||
| - | ### Flash size 32Mbit-C1: 1024KB+1024KB | ||
| - | boot_v1.2+.bin | ||
| - | user1.2048.new.5.bin | ||
| - | esp_init_data_default.bin | ||
| - | blank.bin | ||
| - | </ | ||
| - | * Indicate -- correct for your ESP8266 flash size -- firmware files & addresses. The firmware is broken down into several files. They need to be provided to the ESP Flash Download Tool, together with the corresponding addresses found in the readme.txt file above. For our ESP8266 example it should look like this (Figure {{ref> | ||
| - | <figure AT_reflash> | ||
| - | {{ : | ||
| - | < | ||
| - | </ | ||
| - | * Then, click the START button and wait until the flashing process is over. | ||
| - | |||
| - | === Basic ESP8266 Networking === | ||
| - | After uploading AT firmware and connecting the module to the PC, an ESP8266 can be used as a modem with simple AT commands. | ||
| - | |||
| - | It is possible to connect ESP8266 to a PC with a TTL-Serial-to-USB adapter. Connection to any microcontroller with a serial interface does not need an adapter. The default baud rate settings are 115200, | ||
| - | < | ||
| - | If the response is " | ||
| - | < | ||
| - | |||
| - | < | ||
| - | As a Wifi device ESP8266 can connect to the network in such modes: | ||
| - | * mode 1 -- client mode -- the ESP8266 connecting to an existing wireless network, | ||
| - | * mode 2 -- access point mode (AP) -- other wireless network devices can be connected to the ESP8266, | ||
| - | * mode 3 -- dual mode (router) -- the ESP8266 act as an access point and connect at the same time to an existing wireless network. | ||
| - | By default, the ESP8266’s stock firmware is set to AP mode. If you’d like to confirm that, send the following command: | ||
| - | < | ||
| - | You should get this response: +CWMODE:2, where 2 corresponds to AP mode. To switch ESP8266 to client device mode, we use the following command: | ||
| - | < | ||
| - | Now we can scan the airwaves for all WiFi access points in range. To do that, we send: | ||
| - | < | ||
| - | Then the ESP8266 will return a list of all the access points in range. In with each line will be item consisting of the security level of the access point, the network name, the signal strength, MAC address, and wireless channel used. Possible security levels of the access point < | ||
| - | * 0 -- open, | ||
| - | * 1 -- WEP, | ||
| - | * 2 -- WPA_PSK, | ||
| - | * 3 -- WPA2_PSK, | ||
| - | * 4 -- WPA_WPA2_PSK. | ||
| - | Now we can connect to the available access point using proper " | ||
| - | < | ||
| - | If everything is OK, the ESP8266 will answer: | ||
| - | < | ||
| - | WIFI CONNECTED | ||
| - | WIFI GOT IP | ||
| - | OK | ||
| - | </ | ||
| - | It means that ESP8266 is connected to the chosen AP and got a proper IP address. To check what the assigned address is we send the command: | ||
| - | < | ||
| - | |||
| - | To set up ESp8266 to behave both as a WiFi client as well as a WiFi Access point. | ||
| - | < | ||