How To use ESP-IDF on ESP32-S2 Beta chip
Espressif is distributing a small number of ESP32-S2 Beta-DevKitC V1.1 to customers and community members. This gives people a chance to begin exploring the features of the forthcoming ESP32-S2.
Read the ESP32-S2 announcement
The ESP32-S2 Beta chip is not the same as the final ESP32-S2, the Beta chip is an engineering sample and as a result not all features are available. Software support is still being developed ahead of the final ESP32-S2 release (see the "Limitations" section below).
Set up for CMake
CMake will become the default build system in IDF V4.0 and is the only build system with multiple chip target support.
The setup process for ESP-IDF with CMake is here:
Follow the same Getting Started process before starting to work with the new ESP32-S2 Beta chip.
If you were previously using GNU Make build system, you will need to install additional software as described in the Getting Started guide.
Get the ESP32-S2 toolchain
The ESP32-S2 toolchain version may be updated again before the final release, but you can get a pre-release toolchain here:
Unpack the toolchain archive somewhere and add the bin subdirectory to your PATH, same as described in Getting Started guide for ESP32.
Check out feature/esp32s2beta branch
ESP32-S2 Beta support is not yet merged into the IDF master branch. Instead it is in the feature/esp32s2beta branch.
For an existing ESP-IDF installation:
cd $IDF_PATH git fetch git checkout feature/esp32s2beta git submodule update --init --recursive
For a new ESP-IDF installation:
git clone --recursive -b feature/esp32s2beta https://github.com/espressif/esp-idf.git
(Before continuing, please make sure to have followed the remaining Get Started steps for CMake build system such as installing host tools, setting PATH and IDF_PATH environment variables, etc.)
Building a project for ESP32-S2 Beta target
Important: Support for ESP32-S2 Beta is a work in progress. Not all drivers, examples, etc. are supported in ESP-IDF yet. For our initial example we will use the HTTP request "protocol" example.
cd $IDF_PATH/examples/protocols/http_request rm -rf sdkconfig build idf.py -D IDF_TARGET=esp32s2beta menuconfig idf.py build
Windows Command Prompt users:
Note: There are currently some issues building under Windows. This post will be updated when they are resolved.
cd %IDF_PATH%\examples\protocols/http_request del sdkconfig build idf.py -D IDF_TARGET=esp32s2beta menuconfig idf.py build
To flash and watch output from the new board:
idf.py -p port-name flash monitor
(Replace port-name with COM4 or /dev/ttyUSB0 or similar name of the serial port connected to the ESP32-S2beta chip.)
You should see output similar to the following:
esptool.py v2.7-dev Executing action: flash Choosing default port /dev/ttyUSB0 (use '-p PORT' option to set a specific serial port) Running esptool.py in directory /builds/esp/32/idf/examples/protocols/http_request/build Executing "/builds/esp/env/bin/python /builds/esp/32/idf/components/esptool_py/esptool/esptool.py -p /dev/ttyUSB0 -b 921600 --after hard_reset write_flash @flash_project_args"... esptool.py -p /dev/ttyUSB0 -b 921600 --after hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x10000 http-request.bin 0x1000 bootloader/bootloader.bin esptool.py v2.7-dev Serial port /dev/ttyUSB0 Connecting..... Detecting chip type... ESP32S2beta Chip is ESP32S2 Beta Features: Prerelease Silicon Crystal is 40MHz MAC: 18:fe:34:71:a4:b0 Uploading stub... Running stub... Stub running... Changing baud rate to 921600 Changed. Configuring flash size... Compressed 3072 bytes to 82... Wrote 3072 bytes (82 compressed) at 0x00008000 in 0.0 seconds (effective 7121.2 kbit/s)... Hash of data verified. Compressed 617744 bytes to 349616... Wrote 617744 bytes (349616 compressed) at 0x00010000 in 6.0 seconds (effective 819.4 kbit/s)... Hash of data verified. Compressed 19040 bytes to 11419... Wrote 19040 bytes (11419 compressed) at 0x00001000 in 0.1 seconds (effective 1165.4 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin... Executing action: monitor Running idf_monitor in directory /builds/esp/32/idf/examples/protocols/http_request Executing "/builds/esp/env/bin/python /builds/esp/32/idf/tools/idf_monitor.py -p /dev/ttyUSB0 -b 115200 --toolchain-prefix xtensa-esp32s2-elf- /builds/esp/32/idf/examples/protocols/http_request/build/http-request.elf -m '/builds/esp/env/bin/python' '/builds/esp/32/idf/tools/idf.py' '-D' 'IDF_TARGET=esp32s2beta'"... --- idf_monitor on /dev/ttyUSB0 115200 --- --- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H --- ESP-ROM ver:v1.0.1 Build:Nov 22 2018 17:03:19 rst:0x1 (POWERON_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT) PC:0x00000000 configspi: 0x00000000, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff50f0,len:0x4 load:0x3fff50f4,len:0x1688 load:0x40022000,len:0x1c78 load:0x40024000,len:0x16f4 entry 0x40024340 I (33) boot: ESP-IDF v4.0-dev-839-g8805b25ef-dirty 2nd stage bootloader I (33) boot: compile time 15:34:56 I (35) boot: Enabling RNG early entropy source... I (40) boot: SPI Speed : 40MHz I (44) boot: SPI Mode : DIO I (48) boot: SPI Flash Size : 2MB I (52) boot: Partition Table: I (56) boot: ## Label Usage Type ST Offset Length I (63) boot: 0 nvs WiFi data 01 02 00009000 00006000 I (71) boot: 1 phy_init RF data 01 01 0000f000 00001000 I (78) boot: 2 factory factory app 00 00 00010000 00100000 I (86) boot: End of partition table I (90) esp_image: segment 0: paddr=0x00010020 vaddr=0x3ffd0000 size=0x024a4 ( 9380) load I (101) esp_image: segment 1: paddr=0x000124cc vaddr=0x40028000 size=0x00400 ( 1024) load 0x40028000: _WindowOverflow4 at /builds/esp/32/idf/components/freertos/xtensa_vectors.S:1778 I (108) esp_image: segment 2: paddr=0x000128d4 vaddr=0x40028400 size=0x0c8c0 ( 51392) load I (133) esp_image: segment 3: paddr=0x0001f19c vaddr=0x00000000 size=0x00e74 ( 3700) I (135) esp_image: segment 4: paddr=0x00020018 vaddr=0x3f000018 size=0x11750 ( 71504) map I (159) esp_image: segment 5: paddr=0x00031770 vaddr=0x00000000 size=0x0e8a0 ( 59552) I (175) esp_image: segment 6: paddr=0x00040018 vaddr=0x40080018 size=0x66cc8 (421064) map 0x40080018: _stext at ??:? I (297) boot: Loaded app from partition at offset 0x10000 I (297) boot: Disabling RNG early entropy source... I (297) spiflash: Instruction cache : size 8KB, 8Ways, cache line size 64Byte I (305) cpu_start: Pro cpu up. I (309) cpu_start: Single core mode I (313) heap_init: Initializing. RAM available for dynamic allocation: I (320) heap_init: At 3FFB4000 len 00004000 (16 KiB): DRAM I (326) heap_init: At 3FFD8290 len 0001FD70 (127 KiB): DRAM I (333) heap_init: At 3FFFCDA0 len 00003260 (12 KiB): DRAM I (339) cpu_start: Pro cpu start user code I (21) cpu_start: Starting scheduler on PRO CPU. I (62) wifi: wifi driver task: 3ffdbbbc, prio:23, stack:3584, core=0 I (62) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE I (62) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE I (82) wifi: wifi firmware version: 0fca7cf I (82) wifi: config NVS flash: enabled I (82) wifi: config nano formating: disabled I (82) wifi: Init dynamic tx buffer num: 32 I (92) wifi: Init data frame dynamic rx buffer num: 32 I (92) wifi: Init management frame dynamic rx buffer num: 32 I (102) wifi: Init management short buffer num: 32 I (102) wifi: Init static rx buffer size: 1600 I (102) wifi: Init static rx buffer num: 10 I (112) wifi: Init dynamic rx buffer num: 32 I (112) example_connect: Connecting to MySSID... I (252) phy: phy_version: 10, 6afee14, Jun 14 2019, 20:56:06, 0, 2 I (252) wifi: enable tsf I (252) wifi: mode : sta (18:fe:34:71:a4:b0) I (382) wifi: new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1 I (1362) wifi: state: init -> auth (b0) I (1412) wifi: state: auth -> assoc (0) I (1412) wifi: state: assoc -> run (10) I (1462) wifi: connected with MySSID, channel 1, bssid = 5c:93:a2:e3:7c:95 I (1462) wifi: pm start, type: 1 I (2082) tcpip_adapter: sta ip: 192.168.0.174, mask: 255.255.255.0, gw: 192.168.0.1 I (2082) example_connect: Connected to MySSID I (2092) example_connect: IPv4 address: 192.168.0.174 I (2112) example: DNS lookup succeeded. IP=126.96.36.199 I (2112) example: ... allocated socket I (2502) example: ... connected I (2502) example: ... socket send success I (2502) example: ... set socket receiving timeout success HTTP/1.0 200 OK Cache-Control: max-age=604800 Content-Type: text/html; charset=UTF-8 Date: Mon, 01 Jul 2019 05:44:39 GMT Etag: "1541025663+ident" Expires: Mon, 08 Jul 2019 05:44:39 GMT Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT Server: ECS (oxr/8314) Vary: Accept-Encoding X-Cache: HIT Content-Length: 1270 Connection: close <!doctype html> <html> <head> <title>Example Domain</title> ...
When changing the chip target between ESP32 and ESP32-S2 Beta it is necessary to delete any existing sdkconfig and then run idf.py at least once with the -D IDF_TARGET=esp32s2beta argument.
This is because a single sdkconfig can only be generated with support for a single target. If no target name is given, it will default to ESP32.
When changing target chips, it is recommended to also delete the build directory. This is not a strict requirement, but it is recommended while the ESP-IDF multiple target support is still maturing.
Currently released ESP32-S2 Beta support in ESP-IDF only supports basic features. Espressif firmware developers are working hard on the remaining support, so check the feature/esp32s2beta branch regularly for updates.
Full speed USB OTG peripheral is not supported
Peripheral drivers are a work in progress
No power saving modes
No hardware security features or cryptographic accelerator support
Time-of-Flight (TOF) measurements with normal Wi-Fi packets is not supported
If you find issues which are not mentioned above, please open an issue on GitHub.
Please make sure to mention that you are using the ESP32-S2 Beta chip.