|
1 | 1 | Get Started |
2 | | -================= |
| 2 | +================== |
3 | 3 |
|
4 | 4 | :link_to_translation:`zh_CN:[中文]` |
5 | 5 |
|
6 | | -This document is intended to help you set up the development environment for ESP-IoT-Solution (Espressif IoT Solution). After that, a simple example will show you how to use ESP-IoT-Solution to set up environment, create a project, build and flash firmware onto an ESP series board, etc. |
| 6 | +This document briefly introduces how to obtain and use components in ESP-IoT-Solution, how to compile and run examples, helping beginners get started quickly. |
7 | 7 |
|
8 | | -ESP-IoT-Solution Introduction |
9 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 8 | +ESP-IoT-Solution Version Description |
| 9 | +------------------------------------ |
10 | 10 |
|
11 | | -ESP-IoT-Solution contains peripheral drivers and code frameworks commonly used in IoT system development, which provide complementary components to ESP-IDF to facilitate simpler development, mainly including the following contents: |
| 11 | +ESP-IoT-Solution has adopted component-based management since ``release/v2.0``, with each component and example independently iterating. Please check the component's ``idf_component.yml`` file for the dependent ESP-IDF version. Release branches only maintain historical major versions, while the master branch continuously integrates new features. It is recommended that new projects obtain required components through the component registry. |
12 | 12 |
|
13 | | -- Device drivers such as sensors, screens, audio devices, input devices, actuators, and etc. |
14 | | -- Code framework and related documents of low power management, security encryption, storage and etc. |
15 | | -- Entrance guideline for Espressif's open-source solutions from the perspective of practical application. |
| 13 | +Different version descriptions are as follows. For details and component lists, please see `README_CN.md <https://github.com/espressif/esp-iot-solution/blob/master/README_CN.md>`_: |
16 | 14 |
|
17 | | -ESP-IoT-Solution Versions |
18 | | -****************************** |
| 15 | +.. list-table:: ESP-IoT-Solution Version Support |
| 16 | + :header-rows: 1 |
| 17 | + :widths: 20 20 30 20 |
19 | 18 |
|
20 | | -Specifications of different ESP-IoT-Solution versions are listed in the following table: |
| 19 | + * - ESP-IoT-Solution |
| 20 | + - Dependent ESP-IDF |
| 21 | + - Main Changes |
| 22 | + - Support Status |
| 23 | + * - master |
| 24 | + - >= v5.3 |
| 25 | + - New chip support |
| 26 | + - New feature development branch |
| 27 | + * - release/v2.0 |
| 28 | + - <= v5.3, >= v4.4 |
| 29 | + - Component manager support |
| 30 | + - Historical version maintenance |
| 31 | + * - release/v1.1 |
| 32 | + - v4.0.1 |
| 33 | + - IDF version update, code migration |
| 34 | + - Backup, maintenance stopped |
| 35 | + * - release/v1.0 |
| 36 | + - v3.2.2 |
| 37 | + - Historical version |
| 38 | + - Backup, maintenance stopped |
21 | 39 |
|
22 | | -+--------------------------+-------------------------------+---------------------------------------------------+---------------------------------+ |
23 | | -| ESP-IoT-Solution version | Corresponding ESP-IDF version | Main changes | Status | |
24 | | -+==========================+===============================+===================================================+=================================+ |
25 | | -| master | >=v4.4 | support component manager and new chips | New features development branch | |
26 | | -+--------------------------+-------------------------------+---------------------------------------------------+---------------------------------+ |
27 | | -| release/v1.1 | v4.0.1 | IDF version updated, deleted codes that have been | Stop maintenance | |
28 | | -| | | moved to other repos | | |
29 | | -+--------------------------+-------------------------------+---------------------------------------------------+---------------------------------+ |
30 | | -| release/v1.0 | v3.2.2 | Legacy version | Stop maintenance | |
31 | | -+--------------------------+-------------------------------+---------------------------------------------------+---------------------------------+ |
32 | 40 |
|
33 | | -Since the ``master`` branch uses the ``ESP Component Manager`` to manager components, each of them is a separate package, and each package may support a different version of the ESP-IDF, which will be declared in the component's ``idf_component.yml`` file. |
| 41 | +Development Environment Setup |
| 42 | +----------------------------- |
34 | 43 |
|
35 | | -ESP-IDF Introduction |
36 | | -~~~~~~~~~~~~~~~~~~~~~~~ |
| 44 | +ESP-IDF is the IoT development framework provided by Espressif for ESP series chips: |
37 | 45 |
|
38 | | -ESP-IDF is the IoT development framework for ESP series SoCs provided by Espressif, including: |
| 46 | +- ESP-IDF includes a series of libraries and header files, providing core components required for building software projects based on ESP SoC |
| 47 | +- ESP-IDF also provides the most commonly used tools and functions during development and mass production, such as: build, flash, debug and measurement. |
39 | 48 |
|
40 | | -- A series of libraries and header files, providing core components required for building software projects based on ESP SoC; |
41 | | -- Common tools and functions used during the development and manufacturing processes, e.g., build, flashing, debugging, measurement and etc. |
| 49 | +.. note:: |
42 | 50 |
|
43 | | -.. Note:: |
| 51 | + Please refer to: `ESP-IDF Programming Guide <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/index.html>`__ to complete the ESP-IDF development environment setup. |
44 | 52 |
|
45 | | - For detailed information, please go to `ESP-IDF Programming Guide <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/index.html>`_. |
| 53 | +Hardware Preparation |
| 54 | +-------------------- |
46 | 55 |
|
| 56 | +You can choose any ESP series development board, or refer to the supported development boards in `esp-bsp <https://github.com/espressif/esp-bsp>`__ for a quick start. For specifications of each series chip, please see `ESP Product Selector <https://products.espressif.com/>`__. |
47 | 57 |
|
48 | | -ESP Series SoC Introduction |
49 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 58 | +ESP series SoCs support the following features: |
50 | 59 |
|
51 | | -You can select any development board from ESP series to get started with ESP-IoT-Solution, or select a supported board from the `Boards Component <./basic/boards.html>`_ directly for a quick start. |
| 60 | +- Wi-Fi (2.4 GHz/5 GHz dual-band) |
| 61 | +- Bluetooth 5.x (BLE/Mesh) |
| 62 | +- High-performance multi-core processor, maximum frequency up to 400 MHz |
| 63 | +- Ultra-low power coprocessor and deep sleep mode |
| 64 | +- Rich peripheral interfaces: |
| 65 | + - General interfaces: GPIO, UART, I2C, I2S, SPI, SDIO, USB OTG, etc. |
| 66 | + - Dedicated interfaces: LCD, camera, Ethernet, CAN, Touch, LED PWM, temperature sensor, etc. |
| 67 | +- Large capacity memory: |
| 68 | + - Internal RAM up to 768 KB |
| 69 | + - Support for external PSRAM expansion |
| 70 | + - Support for external Flash storage |
| 71 | +- Enhanced security features: |
| 72 | + - Hardware encryption engine |
| 73 | + - Secure boot |
| 74 | + - Flash encryption |
| 75 | + - Digital signature |
52 | 76 |
|
53 | | -ESP series SoC support the following features: |
| 77 | +ESP series SoCs use advanced process technology, providing industry-leading RF performance, low power consumption characteristics and stable reliability, suitable for IoT, industrial control, smart home, wearable devices and other application scenarios. |
54 | 78 |
|
55 | | -- 2.4 GHz Wi-Fi |
56 | | -- Bluetooth |
57 | | -- High-performance single core, dual-core processor, capable of running at 240 MHz |
58 | | -- Ultra-low-power co-processor |
59 | | -- Various peripherals including GPIO, I2C, I2S, SPI ,UART, SDIO, RMT, LEDC PWM, Ethernet, TWAI®, Touch, USB OTG and etc. |
60 | | -- Rich memory resources, including up to 520 KB internal RAM and can support external PSRAM |
61 | | -- Support security functions, e.g., hardware encryption |
| 79 | +.. note:: |
62 | 80 |
|
63 | | -ESP series of SoC are designed with the 40nm technology, showing the best power and RF performance, versatility and reliability in a wide variety of application and power scenarios. |
| 81 | + For specific specifications and functions of each series chip, please refer to `ESP Product Selector <https://products.espressif.com/>`__. |
64 | 82 |
|
65 | | -.. Note:: |
66 | 83 |
|
67 | | - The configuration varies by SoC series, please refer to `ESP Product Selector <http://products.espressif.com:8000/#/product-selector>`_ for details. |
| 84 | +How to Obtain and Use Components |
| 85 | +-------------------------------- |
68 | 86 |
|
| 87 | +It is recommended to obtain ESP-IoT-Solution components through `ESP Component Registry <https://components.espressif.com/>`__. |
69 | 88 |
|
70 | | -Setting up Development Environment |
71 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 89 | +Taking the button component as an example, the steps to add dependencies are as follows: |
72 | 90 |
|
73 | | -1. Get ESP-IDF |
74 | | -******************* |
| 91 | +1. Execute in the project root directory: |
75 | 92 |
|
76 | | -As ESP-IoT-Solution relies on ESP-IDF basic functions and build tools, please set up ESP-IDF development environment first following `ESP-IDF Installation Step by Step <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#get-started-get-prerequisites>`_. Please note that different versions of ESP-IoT-Solution may rely on different ESP-IDF versions, please refer to `ESP-IoT-Solution Versions`_ for specifications. |
| 93 | + .. code-block:: bash |
77 | 94 |
|
78 | | -2. Get ESP-IoT-Solution |
79 | | -***************************** |
| 95 | + idf.py add-dependency "espressif/button" |
80 | 96 |
|
81 | | -For ``master`` version, please use the following command: |
| 97 | +2. Reference header files in code and call APIs, for example: |
82 | 98 |
|
83 | | -.. code:: shell |
| 99 | + .. code-block:: c |
84 | 100 |
|
85 | | - git clone --recursive https://github.com/espressif/esp-iot-solution |
| 101 | + #include "iot_button.h" |
| 102 | + // For specific API usage, please refer to component documentation |
86 | 103 |
|
87 | | -For ``release/v1.1`` version, please use the following command: |
| 104 | +For more information on component manager usage, please refer to `ESP Registry Docs <https://docs.espressif.com/projects/idf-component-manager/en/latest/>`__. |
88 | 105 |
|
89 | | -.. code:: shell |
| 106 | +How to Use Example Programs |
| 107 | +--------------------------- |
90 | 108 |
|
91 | | - git clone -b release/v1.1 --recursive https://github.com/espressif/esp-iot-solution |
| 109 | +ESP-IoT-Solution provides rich example programs to help users get started quickly. Taking the ``button_power_save`` example: |
92 | 110 |
|
93 | | -For other versions, please also use this command with ``release/v1.1`` replaced by your target branch name. |
| 111 | +1. Ensure that the ESP-IDF development environment setup has been completed and environment variables have been successfully configured |
94 | 112 |
|
95 | | -Use ESP-IoT-Solution Components |
96 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 113 | +2. Download the ESP-IoT-Solution code repository: |
97 | 114 |
|
98 | | -If you just want to use the components in ESP-IoT-Solution, we recommend you use it from the `ESP Component Registry <https://components.espressif.com/>`_. |
| 115 | + .. code-block:: bash |
99 | 116 |
|
100 | | -The registered components in ESP-IoT-Solution are listed in :project_file:`README.md` , You can directly add the components from the Component Registry to your project by using the ``idf.py add-dependency`` command under your project's root directory. eg run ``idf.py add-dependency "espressif/usb_stream"`` to add the ``usb_stream``, the component will be downloaded automatically during the ``CMake`` step. |
| 117 | + git clone https://github.com/espressif/esp-iot-solution.git |
101 | 118 |
|
102 | | -Please refer to `IDF Component Manager <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-component-manager.html>`_ for details. |
| 119 | +3. Enter the example directory or copy it to your working directory: |
103 | 120 |
|
104 | | -Build and Download |
105 | | -~~~~~~~~~~~~~~~~~~~~~~ |
| 121 | + .. code-block:: bash |
106 | 122 |
|
107 | | -1. Set up the environment variables |
108 | | -******************************************** |
| 123 | + cd examples/get-started/button_power_save |
109 | 124 |
|
110 | | -The tools installed in above steps are not yet added to the PATH environment variables. To make the tools usable from the command line, please follow the following steps to add environment variables: |
| 125 | + .. note:: |
111 | 126 |
|
112 | | -* Add ESP-IDF environment variables: |
| 127 | + If you copy the example to another directory, due to file path changes, please delete all ``override_path`` configurations in ``main/idf_component.yml``. |
113 | 128 |
|
114 | | - For Windows system, please open the Command Prompt and run: |
| 129 | +4. Select target chip (such as ESP32, required when using for the first time or switching chips): |
115 | 130 |
|
116 | | - .. code:: shell |
| 131 | + .. code-block:: bash |
117 | 132 |
|
118 | | - %userprofile%\esp\esp-idf\export.bat |
| 133 | + idf.py set-target esp32 |
119 | 134 |
|
120 | | - For Linux and macOS, please run: |
| 135 | +5. Configure project (optional): |
121 | 136 |
|
122 | | - .. code:: shell |
| 137 | + .. code-block:: bash |
123 | 138 |
|
124 | | - . $HOME/esp/esp-idf/export.sh |
125 | | - |
126 | | - Please remember to replace the paths in above commands as your actual paths. |
| 139 | + idf.py menuconfig |
127 | 140 |
|
128 | | -* Add IOT_SOLUTION_PATH environment variables: |
| 141 | +6. Compile and flash to development board: |
129 | 142 |
|
130 | | - For Windows system, please open the Command Prompt and run: |
| 143 | + .. code-block:: bash |
131 | 144 |
|
132 | | - .. code:: shell |
| 145 | + idf.py build |
| 146 | + idf.py -p <PORT> flash |
133 | 147 |
|
134 | | - set IOT_SOLUTION_PATH=C:\esp\esp-iot-solution |
| 148 | +7. Monitor output through serial port: |
135 | 149 |
|
136 | | - For Linux and macOS, please run: |
| 150 | + .. code-block:: bash |
137 | 151 |
|
138 | | - .. code:: shell |
| 152 | + idf.py -p <PORT> monitor |
139 | 153 |
|
140 | | - export IOT_SOLUTION_PATH=~/esp/esp-iot-solution |
141 | | -
|
142 | | -.. Note:: |
143 | | - |
144 | | - The environment variables set by the above method are only valid in the current terminal. Please repeat above steps if you open a new terminal. |
145 | | - |
146 | | -2. Set build target |
147 | | -*********************** |
148 | | - |
149 | | -ESP-IDF supports multiple chips as ``esp32``, ``esp32s2`` and others, please set your target chip before building (the default target is ``esp32``). For example, you can set the build target as ``esp32s2``. |
150 | | - |
151 | | -.. code:: shell |
152 | | -
|
153 | | - idf.py set-target esp32s2 |
154 | | -
|
155 | | -For examples in ESP-IoT-Solution developed based on `Boards Component <./basic/boards.html>`_, you can go to ``Board Options -> Choose Target Board`` in ``menuconfig`` to choose a target board: |
156 | | - |
157 | | -.. code:: shell |
158 | | -
|
159 | | - idf.py menuconfig |
160 | | -
|
161 | | -3. Build and download the program |
162 | | -*************************************** |
163 | | - |
164 | | -Use the ``idf.py`` tool to build and download the program with: |
165 | | - |
166 | | -.. code:: shell |
167 | | -
|
168 | | - idf.py -p PORT build flash |
169 | | -
|
170 | | -Please replace PORT with your board's port name. Serial ports have the following patterns in their names: Windows is like ``COMx``; Linux starting with ``/dev/ttyUSBx``; macOS usually is ``/dev/cu.``. |
171 | | - |
172 | | -4. Serial print log |
173 | | -*********************** |
174 | | - |
175 | | -Use the ``idf.py`` tool to see logs: |
176 | | - |
177 | | -.. code:: shell |
178 | | -
|
179 | | - idf.py -p PORT monitor |
180 | | -
|
181 | | -Do not forget to replace PORT with your serial port name (``COMx`` for Windows; ``/dev/ttyUSBx`` for Linux; ``/dev/cu.`` for macOS). |
182 | | - |
183 | | -Related Documents |
184 | | -~~~~~~~~~~~~~~~~~~~~~~~~~ |
185 | | - |
186 | | -- `ESP-IDF Installation Step by Step <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#get-started-get-prerequisites>`_ |
187 | | -- `ESP-IDF Get Started <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html>`_ |
188 | | -- `ESP Product Selector <http://products.espressif.com:8000/#/product-selector>`_ |
| 154 | +For more examples, please see the ``examples/`` directory. For specific usage methods, please refer to the README files under each example. |
0 commit comments