dos(api-guides): Fix document format and information error

This commit is contained in:
Dong Heng
2019-02-01 09:35:30 +08:00
parent 34230f45d4
commit aaad632be7
5 changed files with 99 additions and 53 deletions

View File

@ -54,21 +54,27 @@ Connect your host PC and the ESP8266 to the same AP.
Step 2: Configure and Build
-----------------------------
Here, we use the [SP8266_RTOS_SDK/examples/system/ota](https://github.com/espressif/ESP8266_RTOS_SDK/tree/master/examples/system/ota) example.
Here, we use the `SP8266_RTOS_SDK/examples/system/ota <https://github.com/espressif/ESP8266_RTOS_SDK/tree/master/examples/system/ota>`_ example.
Open a new terminal on your PC, set the following configurations, and then compile the example:
1. Enter the target directory
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- cd $IDF_PATH/examples/system/ota
::
cd $IDF_PATH/examples/system/ota
2. Enable the OTA compatibility function
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Component config --->
- ESP8266-specific --->
- [*] (**Expected**)ESP8266 update from old SDK by OTA
::
Component config --->
ESP8266-specific --->
[*] (**Expected**)ESP8266 update from old SDK by OTA
3. Configure the target custom partition
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -80,16 +86,29 @@ ESP8285(ESP8266 + 1MB flash) configuration:
Set the file "partitions_two_ota_v2tov3.1MB.csv" to configure the partition of the example. Users can refer to its note for the partition layout.
- Partition Table --->
- Partition Table (Custom partition table CSV) --->
- Custom partition table CSV
- (partitions_two_ota_v2tov3.1MB.csv) Custom partition CSV file
- (0x5000) Partition table offset address at flash
- [*] Support to setup partition parameter of APP2
- (0x7000) APP1 partition offset
- (0x77000) APP1 partition size(by bytes)
- (0x85000) APP2 partition offset
- (0x77000) APP2 partition size(by bytes)
::
Partition Table --->
Partition Table (Custom partition table CSV) --->
Custom partition table CSV
(partitions_two_ota_v2tov3.1MB.csv) Custom partition CSV file
(0x5000) Partition table offset address at flash
[*] Support to setup partition parameter of APP2
(0x7000) APP1 partition offset
(0x77000) APP1 partition size(by bytes)
(0x85000) APP2 partition offset
(0x77000) APP2 partition size(by bytes)
Partition information of file "partitions_two_ota_v2tov3.1MB.csv" is following:
::
Name, Type, SubType, Offset, Size, Flags
phy_init, data, phy, 0x6000, 0x1000
ota_0, 0, ota_0, 0x7000, 0x77000
nvs, data, nvs, 0x7f000, 0x4000
otadata, data, ota, 0x83000, 0x2000
ota_1, 0, ota_1, 0x85000, 0x77000
- Partition table offset address at flash: partition table layout address
- APP1 partition offset: ota_0 base address
@ -102,13 +121,26 @@ ESP8266 + 2MB(including larger size flash) flash configuration:
Set the file "partitions_two_ota_v2tov3.2MB.csv" to configure the partition of the example. Users can refer to its note for the partition layout.
- Partition Table --->
- Partition Table (Custom partition table CSV) --->
- Custom partition table CSV
- (partitions_two_ota_v2tov3.2MB.csv) Custom partition CSV file
- (0x8000) Partition table offset address at flash
- (0x10000) APP1 partition offset
- (0xEC000) APP1 partition size(by bytes)
::
Partition Table --->
Partition Table (Custom partition table CSV) --->
Custom partition table CSV
(partitions_two_ota_v2tov3.2MB.csv) Custom partition CSV file
(0x8000) Partition table offset address at flash
(0x10000) APP1 partition offset
(0xEC000) APP1 partition size(by bytes)
Partition information of file "partitions_two_ota_v2tov3.2MB.csv" is following:
::
Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
ota_0, 0, ota_0, 0x10000, 0xEC000
ota_1, 0, ota_1, 0x110000,0xEC000
- Partition table offset address at flash: partition table layout address
- APP1 partition offset: ota_0 base address
@ -116,19 +148,23 @@ Set the file "partitions_two_ota_v2tov3.2MB.csv" to configure the partition of t
Configure the flash size according to your actual development board's flash.
- Serial flasher config --->
- Flash size (x MB) ---> real flash size
::
Serial flasher config --->
Flash size (x MB) ---> real flash size
4. Configure example's parameters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Example Configuration --->
- (myssid) WiFi SSID
- (mypassword) WiFi Password
- (192.168.0.3) HTTP Server IP
- (8070)HTTP Server Port
- (/project_template.ota.bin) HTTP GET Filename
::
Example Configuration --->
(myssid) WiFi SSID
(mypassword) WiFi Password
(192.168.0.3) HTTP Server IP
(8070)HTTP Server Port
(/project_template.ota.bin) HTTP GET Filename
- WiFi SSID: Wi-Fi SSID of router
- WiFi Password: Wi-Fi password of router
@ -139,9 +175,9 @@ Configure the flash size according to your actual development board's flash.
5. Build the project
^^^^^^^^^^^^^^^^^^^^
Input following command to start building:
Input following command to start building::
- make ota
make ota
After compiling, the final firmware "ota.v2_to_v3.ota.bin" will be generated. Then users can download and update to this new firmware when running an old SDK OTA application.
@ -150,19 +186,20 @@ After compiling, the final firmware "ota.v2_to_v3.ota.bin" will be generated. Th
4. Start HTTP Server
^^^^^^^^^^^^^^^^^^^^
```
cd build
python -m SimpleHTTPServer 8070
```
::
cd build
python -m SimpleHTTPServer 8070
Note
====
* It will take a lot of time for the new bootloader unpacking the firmware at the first time, please wait a while.
- It will take a lot of time for the new bootloader unpacking the firmware at the first time, please wait a while.
* The terminal will print some log that shows the progress:
* log "I (281) boot: Start unpacking V3 firmware ...", it means that bootloader starts unpacking.
* log "Pack V3 firmware successfully and start to reboot", it means that bootloader unpacked firmware successfully.
- The terminal will print some log that shows the progress:
- log "I (281) boot: Start unpacking V3 firmware ...", it means that bootloader starts unpacking.
- log "Pack V3 firmware successfully and start to reboot", it means that bootloader unpacked firmware successfully.
* This "unpacking workflow" will only be executed when it is an old SDK firmware that upgrade to the new SDK firmware, for example, V2.0 upgrade to V3.1. After that, the FOTA in later versions (for example, V3.1 upgrade to later) will be the [normal FOTA workflow](https://github.com/espressif/ESP8266_RTOS_SDK/blob/master/examples/system/ota/README.md).
- This "unpacking workflow" will only be executed when it is an old SDK firmware that upgrade to the new SDK firmware, for example, V2.0 upgrade to V3.1. After that, the FOTA in later versions (for example, V3.1 upgrade to later) will be the `normal FOTA workflow <https://github.com/espressif/ESP8266_RTOS_SDK/blob/master/examples/system/ota/README.md>`_.

View File

@ -1,30 +1,35 @@
PWM & Sniffer Co-exists
=======================
***********************
1. Overview
-----------
===========
Without hardware PWM, ESP8266 has to use the hardware timer to simulate the PWM. We are using the Wi-Fi internal timer to drive the PWM, so there may be resource competition issue when using PWM and sniffer/SmartConfig at the same time.
2. Root Cause
-------------
=============
To ensure the high precision of the PWM, the hardware Timer1 will trigger the interrupt AHEAD_TICKS1(6us by default) earlier. And in the interrupt, it will poll to wait for AHEAD_TICKS1(6us by default). After handling the GPIO invert in one channel, the system will check the remaining time (T1) to the next channel invert. If the T1 < AHEAD_TICKS2(8us by default), the system will not exit the interrupt, but poll to wait till timeout, and then invert the GPIO in the next channel; then the system will repeat these steps until all channels inverted.
So theoretically, the max time that PWM may occupy the CPU is 6 + 8 * n, n means the channel count. For example, if there are 3 channels, then PWM may take 30us at most. In this case, PWM will affect the Wi-Fi sniffer/SmartConfig function, especially for the capture of the LDPC packets, or HT40 packets which require the CPU to handle them in time, otherwise those packets will loss.
To ensure the high precision of the PWM, the hardware Timer1 will trigger the interrupt AHEAD_TICKS1(6us by default) earlier. And in the interrupt, it will poll to wait for AHEAD_TICKS1(6us by default).
After handling the GPIO invert in one channel, the system will check the remaining time (T1) to the next channel invert.
If the T1 < AHEAD_TICKS2(8us by default), the system will not exit the interrupt, but poll to wait till timeout, and then invert the GPIO in the next channel; then the system will repeat these steps until all channels inverted.
So theoretically, the max time that PWM may occupy the CPU is 6 + 8 * n, n means the channel count. For example, if there are 3 channels, then PWM may take 30us at most.
In this case, PWM will affect the Wi-Fi sniffer/SmartConfig function, especially for the capture of the LDPC packets, or HT40 packets which require the CPU to handle them in time, otherwise those packets will loss.
3. Issue that may happen
------------------------
========================
If your application used both PWM and sniffer/SmartConfig, the sniffer/SmartConfig may take a long time to connect to an AP.
You can stop the PWM and try it again. If the sniffer/SmartConfig becomes much faster, then it is the PWM that affect the sniffer/SmartConfig. In this case, you should adjust the frequency, duty cycle and phase of the PWM.
4. Suggestion
-------------
=============
When using the PWM and SmartConfig at the same time, please note:
1. The PWM's frequency cannot be too high, 2KHz at most.
2. Revise the PWM's duty cycle and phase, make the time intervals (Tn) between each channel inverting be equal to 0 or be larger than 50us (Tn = 0, or Tn > 50).
2. Revise the PWM's duty cycle and phase, make the time intervals (Tn) between each channel inverting be equal to 0 or be larger than 50us (Tn = 0, or Tn > 50).

View File

@ -12,7 +12,7 @@ from conf_common import *
# General information about the project.
project = u'ESP-IDF Programming Guide'
copyright = u'2016 - 2018, Espressif Systems (Shanghai) PTE LTD'
copyright = u'2016 - 2019, Espressif Systems (Shanghai) PTE LTD'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@ -9,14 +9,18 @@ Adding this content here is to improve the user's development efficiency and avo
V3.1 updated the bootloader to initialize SPI flash I/O mode and clock. So if you are using the V3.0 bootloader,
and now upgrade to the new SDK, please disable the following configuration in the menuconfig:
- "Bootloader config ---> [ ] Bootloader init SPI flash"
::
"Bootloader config --->
[ ] Bootloader init SPI flash"
2. Sniffer or Smartconfig
^^^^^^^^^^^^^^^^^^^^^^^^^
We moved some functions from IRAM to flash, including `malloc` and `free` fucntions, to save more memory.
In this case, please do not read/write/erase flash during sniffer/promiscuous mode.
You need to disable the sniffer/promiscuous mode at first, then read/write/erase flash.
3. ESP8285 or ESP8266 + 1MB flash