mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Replaced ASCII art drawings with blockdiag drawings
This commit is contained in:
parent
8955db6d29
commit
713141e631
@ -73,25 +73,49 @@ as the default error-handling code in the application development phase. However
|
|||||||
|
|
||||||
ESP32 Wi-Fi Programming Model
|
ESP32 Wi-Fi Programming Model
|
||||||
------------------------------
|
------------------------------
|
||||||
The ESP32 Wi-Fi programming model is depicted as follows::
|
The ESP32 Wi-Fi programming model is depicted as follows:
|
||||||
|
|
||||||
|
.. blockdiag::
|
||||||
|
:caption: Wi-Fi Programming Model
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
blockdiag wifi-programming-model {
|
||||||
|
|
||||||
|
# global attributes
|
||||||
|
node_height = 60;
|
||||||
|
node_width = 100;
|
||||||
|
span_width = 100;
|
||||||
|
span_height = 60;
|
||||||
|
default_shape = roundedbox;
|
||||||
|
default_group_color = none;
|
||||||
|
|
||||||
|
# node labels
|
||||||
|
TCP_STACK [label="TCP\n stack", fontsize=12];
|
||||||
|
EVNT_TASK [label="Event\n task", fontsize=12];
|
||||||
|
APPL_TASK [label="Application\n task", width = 120, fontsize=12];
|
||||||
|
WIFI_DRV [label="Wi-Fi\n Driver", width = 120, fontsize=12];
|
||||||
|
KNOT [shape=none];
|
||||||
|
|
||||||
|
# node connections + labels
|
||||||
|
TCP_STACK -> EVNT_TASK [label=event];
|
||||||
|
EVNT_TASK -> APPL_TASK [label="callback\n or event"];
|
||||||
|
|
||||||
|
# arrange nodes vertically
|
||||||
|
group {
|
||||||
|
label = "default handler";
|
||||||
|
orientation = portrait;
|
||||||
|
EVNT_TASK <- WIFI_DRV [label=event];
|
||||||
|
}
|
||||||
|
|
||||||
|
# intermediate node
|
||||||
|
group {
|
||||||
|
label = "user handler";
|
||||||
|
orientation = portrait;
|
||||||
|
APPL_TASK -- KNOT;
|
||||||
|
}
|
||||||
|
WIFI_DRV <- KNOT [label="API\n call"];
|
||||||
|
}
|
||||||
|
|
||||||
default handler user handler
|
|
||||||
----------- ------------- -------------
|
|
||||||
| | event | | callback or | |
|
|
||||||
| TCPIP | ---------> | event | ----------> | application |
|
|
||||||
| stack | | task | event | task |
|
|
||||||
----------- ------------- -------------
|
|
||||||
/|\ |
|
|
||||||
| |
|
|
||||||
event | |
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
------------- |
|
|
||||||
| | |
|
|
||||||
| Wi-Fi Driver|/__________________|
|
|
||||||
| |\ API call
|
|
||||||
| |
|
|
||||||
-------------
|
|
||||||
|
|
||||||
The Wi-Fi driver can be considered a black box that knows nothing about high-layer code, such as the
|
The Wi-Fi driver can be considered a black box that knows nothing about high-layer code, such as the
|
||||||
TCPIP stack, application task, event task, etc. All the Wi-Fi driver can do is receive API calls from the high layer,
|
TCPIP stack, application task, event task, etc. All the Wi-Fi driver can do is receive API calls from the high layer,
|
||||||
@ -211,77 +235,60 @@ Currently, the ESP32 implementation will never generate this event. It may be re
|
|||||||
|
|
||||||
ESP32 Wi-Fi Station General Scenario
|
ESP32 Wi-Fi Station General Scenario
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
Below is a "big scenario" which describes some small scenarios in Station mode::
|
Below is a "big scenario" which describes some small scenarios in Station mode:
|
||||||
|
|
||||||
--------- --------- --------- --------- ---------
|
.. seqdiag::
|
||||||
| Main | | app | | Event | | LwIP | | Wi-Fi |
|
:caption: Sample Wi-Fi Event Scenarios in Station Mode
|
||||||
| task | | task | | task | | task | | task |
|
:align: center
|
||||||
--------- --------- --------- --------- ---------
|
|
||||||
| | | | | ---
|
seqdiag sample-scenarios-station-mode {
|
||||||
| 1.1> create/init LwIP | | | |
|
activation = none;
|
||||||
|---------------------------------------------------------->| | |
|
node_width = 80;
|
||||||
| 1.2> create/init event | | |
|
node_height = 60;
|
||||||
|-------------------------------------->| | | 1. Init Phase
|
edge_length = 140;
|
||||||
| | 1.3> create/init Wi-Fi | |
|
span_height = 5;
|
||||||
|----------------------------------------------------------------------------->| |
|
default_shape = roundedbox;
|
||||||
| 1.4> create app task | | | |
|
default_fontsize = 12;
|
||||||
|------------------>| | | | |
|
|
||||||
| | | | | ---
|
MAIN_TASK [label = "Main\ntask"];
|
||||||
| | | | | |
|
APP_TASK [label = "App\ntask"];
|
||||||
| | | | |
|
EVENT_TASK [label = "Event\ntask"];
|
||||||
| | 2> configure Wi-Fi | | 2. Configure Phase
|
LWIP_TASK [label = "LwIP\ntask"];
|
||||||
|----------------------------------------------------------------------------->|
|
WIFI_TASK [label = "Wi-Fi\ntask"];
|
||||||
| | | | | |
|
|
||||||
| | | | | ---
|
=== 1. Init Phase ===
|
||||||
| | 3.1> start Wi-Fi | | |
|
MAIN_TASK -> LWIP_TASK [label="1.1> Create / init LwIP"];
|
||||||
|----------------------------------------------------------------------------->|
|
MAIN_TASK -> EVENT_TASK [label="1.2> Create / init event"];
|
||||||
| | | 3.2 > SYSTEM_EVENT_STA_START | 3. Start Phase
|
MAIN_TASK -> WIFI_TASK [label="1.3> Create / init Wi-Fi"];
|
||||||
| | |<-------------------------------------|
|
MAIN_TASK -> APP_TASK [label="1.4> Create app task"];
|
||||||
| 3.3> SYSTEM_EVENT_STA_START | | |
|
=== 2. Configure Phase ===
|
||||||
| |<------------------| | | ---
|
MAIN_TASK -> WIFI_TASK [label="2> Configure Wi-Fi"];
|
||||||
| | | | | |
|
=== 3. Start Phase ===
|
||||||
| | | | | |
|
MAIN_TASK -> WIFI_TASK [label="3.1> Start Wi-Fi"];
|
||||||
| | 4.1> connect wifi | | |
|
EVENT_TASK <- WIFI_TASK [label="3.2> SYSTEM_EVENT_STA_START"];
|
||||||
| |--------------------------------------------------------->| 4. Connect Phase
|
APP_TASK <- EVENT_TASK [label="3.3> SYSTEM_EVENT_STA_START"];
|
||||||
| | | 4.2> SYSTEM_EVENT_STA_CONNECTED | |
|
=== 4. Connect Phase ===
|
||||||
| | |<-------------------------------------| |
|
APP_TASK -> WIFI_TASK [label="4.1> Connect Wi-Fi"];
|
||||||
| 4.3> SYSTEM_EVENT_STA_CONNECTED | | |
|
EVENT_TASK <- WIFI_TASK [label="4.2> SYSTEM_EVENT_STA_CONNECTED"];
|
||||||
| |<------------------| | | ---
|
APP_TASK <- EVENT_TASK [label="4.3> SYSTEM_EVENT_STA_CONNECTED"];
|
||||||
| | | | | |
|
=== 5. Got IP Phase ===
|
||||||
| | | | | |
|
EVENT_TASK -> LWIP_TASK [label="5.1> Start DHCP client"];
|
||||||
| | 5.1> start DHCP client | | |
|
EVENT_TASK <- LWIP_TASK [label="5.2> SYSTEM_EVENT_STA_GOT_IP"];
|
||||||
| | |------------------>| | |
|
APP_TASK <- EVENT_TASK [label="5.3> SYSTEM_EVENT_STA_GOT_IP"];
|
||||||
| | 5.2> SYSTEM_EVENT_STA_GOT_IP | |
|
APP_TASK -> APP_TASK [label="5.4> socket related init"];
|
||||||
| | |<------------------| |
|
=== 6. Disconnect Phase ===
|
||||||
| 5.3> SYSTEM_EVENT_STA_GOT_IP | | 5. Got IP Phase
|
EVENT_TASK <- WIFI_TASK [label="6.1> SYSTEM_EVENT_STA_DISCONNECTED"];
|
||||||
| |<------------------| | |
|
APP_TASK <- EVENT_TASK [label="6.2> SYSTEM_EVENT_STA_DISCONNECTED"];
|
||||||
| |----- | | | |
|
APP_TASK -> APP_TASK [label="6.3> disconnect handling"];
|
||||||
| | | 5.4> socket related init | | |
|
=== 7. IP Change Phase ===
|
||||||
| |<---- | | | |
|
EVENT_TASK <- LWIP_TASK [label="7.1> SYSTEM_EVENT_STA_GOT_IP"];
|
||||||
| | | | | ---
|
APP_TASK <- EVENT_TASK [label="7.2> SYSTEM_EVENT_STA_GOT_IP"];
|
||||||
| | | 6.1> SYSTEM_EVENT_STA_DISCONNECTED | |
|
APP_TASK -> APP_TASK [label="7.3> Socket error handling"];
|
||||||
| | |<-------------------------------------|
|
=== 8. Deinit Phase ===
|
||||||
| 6.2> SYSTEM_EVENT_STA_DISCONNECTED | | 6. Disconnect Phase
|
APP_TASK -> WIFI_TASK [label="8.1> Disconnect Wi-Fi"];
|
||||||
| |<------------------| | |
|
APP_TASK -> WIFI_TASK [label="8.2> Stop Wi-Fi"];
|
||||||
| |----- | | | |
|
APP_TASK -> WIFI_TASK [label="8.3> Deinit Wi-Fi"];
|
||||||
| | | 6.3> disconnect handling | | |
|
}
|
||||||
| |<---- | | | ---
|
|
||||||
| | | | | |
|
|
||||||
| | 7.1> SYSTEM_EVENT_STA_GOT_IP | |
|
|
||||||
| | |<------------------| | |
|
|
||||||
| 7.2> SYSTEM_EVENT_STA_GOT_IP | |
|
|
||||||
| |<------------------| | | 7. IP change phase
|
|
||||||
| |----- | | |
|
|
||||||
| | | 7.3> socket error handling | | |
|
|
||||||
| |<---- | | | |
|
|
||||||
| | | | | ---
|
|
||||||
| | 8.1> disconnect Wi-Fi | | |
|
|
||||||
| |--------------------------------------------------------->|
|
|
||||||
| | 8.2> stop Wi-Fi | | 8. Deinit phase
|
|
||||||
| |--------------------------------------------------------->|
|
|
||||||
| | 8.3> deinit Wi-Fi | | |
|
|
||||||
| |--------------------------------------------------------->| |
|
|
||||||
| | | | | ---
|
|
||||||
|
|
||||||
|
|
||||||
1. Wi-Fi/LwIP Init Phase
|
1. Wi-Fi/LwIP Init Phase
|
||||||
@ -349,62 +356,50 @@ In step 4.2, the Wi-Fi connection may fail because, for example, the password is
|
|||||||
|
|
||||||
ESP32 Wi-Fi soft-AP General Scenario
|
ESP32 Wi-Fi soft-AP General Scenario
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
Below is a "big scenario" which describes some small scenarios in Soft-AP mode::
|
Below is a "big scenario" which describes some small scenarios in Soft-AP mode:
|
||||||
|
|
||||||
--------- --------- --------- --------- ---------
|
.. seqdiag::
|
||||||
| Main | | app | | Event | | LwIP | | Wi-Fi |
|
:caption: Sample Wi-Fi Event Scenarios in Soft-AP Mode
|
||||||
| task | | task | | task | | task | | task |
|
:align: center
|
||||||
--------- --------- --------- --------- ---------
|
|
||||||
| | | | |
|
seqdiag sample-scenarios-soft-ap-mode {
|
||||||
| | | | | ---
|
activation = none;
|
||||||
| 1.1> create/init LwIP | | | |
|
node_width = 80;
|
||||||
|---------------------------------------------------------->| | |
|
node_height = 60;
|
||||||
| 1.2> create/init event | | |
|
edge_length = 140;
|
||||||
|-------------------------------------->| | | 1. Init Phase
|
span_height = 5;
|
||||||
| | 1.3> create/init Wi-Fi | |
|
default_shape = roundedbox;
|
||||||
|----------------------------------------------------------------------------->| |
|
default_fontsize = 12;
|
||||||
| 1.4> create app task | | | |
|
|
||||||
|------------------>| | | | |
|
MAIN_TASK [label = "Main\ntask"];
|
||||||
| | | | | ---
|
APP_TASK [label = "App\ntask"];
|
||||||
| | | | | |
|
EVENT_TASK [label = "Event\ntask"];
|
||||||
| | | | |
|
LWIP_TASK [label = "LwIP\ntask"];
|
||||||
| | 2> configure Wi-Fi | | 2. Configure Phase
|
WIFI_TASK [label = "Wi-Fi\ntask"];
|
||||||
|----------------------------------------------------------------------------->|
|
|
||||||
| | | | | |
|
=== 1. Init Phase ===
|
||||||
| | | | | ---
|
MAIN_TASK -> LWIP_TASK [label="1.1> Create / init LwIP"];
|
||||||
| | | | | |
|
MAIN_TASK -> EVENT_TASK [label="1.2> Create / init event"];
|
||||||
| | 3.1> start Wi-Fi | |
|
MAIN_TASK -> WIFI_TASK [label="1.3> Create / init Wi-Fi"];
|
||||||
|----------------------------------------------------------------------------->| 3. Start Phase
|
MAIN_TASK -> APP_TASK [label="1.4> Create app task"];
|
||||||
| | | 3.2 > SYSTEM_EVENT_AP_START |
|
=== 2. Configure Phase ===
|
||||||
| | |<-------------------------------------| |
|
MAIN_TASK -> WIFI_TASK [label="2> Configure Wi-Fi"];
|
||||||
| 3.3> SYSTEM_EVENT_AP_START | | |
|
=== 3. Start Phase ===
|
||||||
| |<------------------| | | ---
|
MAIN_TASK -> WIFI_TASK [label="3.1> Start Wi-Fi"];
|
||||||
| | | | | |
|
EVENT_TASK <- WIFI_TASK [label="3.2> SYSTEM_EVENT_AP_START"];
|
||||||
| | | | |
|
APP_TASK <- EVENT_TASK [label="3.3> SYSTEM_EVENT_AP_START"];
|
||||||
| | | 4.1> SYSTEM_EVENT_AP_STACONNECTED | 4. Connect Phase
|
=== 4. Connect Phase ===
|
||||||
| | |<-------------------------------------|
|
EVENT_TASK <- WIFI_TASK [label="4.1> SYSTEM_EVENT_AP_STA_CONNECTED"];
|
||||||
| 4.2> SYSTEM_EVENT_AP_STACONNECTED | | |
|
APP_TASK <- EVENT_TASK [label="4.2> SYSTEM_EVENT_AP_STA_CONNECTED"];
|
||||||
| |<------------------| | | ---
|
=== 5. Disconnect Phase ===
|
||||||
| | | | | |
|
EVENT_TASK <- WIFI_TASK [label="5.1> SYSTEM_EVENT_STA_DISCONNECTED"];
|
||||||
| | | | | |
|
APP_TASK <- EVENT_TASK [label="5.2> SYSTEM_EVENT_STA_DISCONNECTED"];
|
||||||
| | | 5.1> SYSTEM_EVENT_STA_DISCONNECTED |
|
APP_TASK -> APP_TASK [label="5.3> disconnect handling"];
|
||||||
| | |<-------------------------------------| 5. Disconnect Phase
|
=== 6. Deinit Phase ===
|
||||||
| 5.2> SYSTEM_EVENT_STA_DISCONNECTED | |
|
APP_TASK -> WIFI_TASK [label="6.1> Disconnect Wi-Fi"];
|
||||||
| |<------------------| | | |
|
APP_TASK -> WIFI_TASK [label="6.2> Stop Wi-Fi"];
|
||||||
| |----- | | | |
|
APP_TASK -> WIFI_TASK [label="6.3> Deinit Wi-Fi"];
|
||||||
| | | 5.3> disconnect handling | | |
|
}
|
||||||
| |<---- | | | ---
|
|
||||||
| | | | | |
|
|
||||||
| | | | | |
|
|
||||||
| | | | | |
|
|
||||||
| | 6.1> disconnect Wi-Fi | | |
|
|
||||||
| |--------------------------------------------------------->|
|
|
||||||
| | 6.2> stop Wi-Fi | | 6. Deinit phase
|
|
||||||
| |--------------------------------------------------------->|
|
|
||||||
| | 6.3> deinit Wi-Fi | | |
|
|
||||||
| |--------------------------------------------------------->| |
|
|
||||||
| | | | | ---
|
|
||||||
| | | | |
|
|
||||||
|
|
||||||
|
|
||||||
ESP32 Wi-Fi Scan
|
ESP32 Wi-Fi Scan
|
||||||
@ -514,38 +509,34 @@ The scan type and other scan attributes are configured by esp_wifi_scan_start. T
|
|||||||
Scan All APs In All Channels(foreground)
|
Scan All APs In All Channels(foreground)
|
||||||
+++++++++++++++++++++++++++++++++++++++++++
|
+++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
Scenario::
|
Scenario:
|
||||||
|
|
||||||
--------- --------- ---------
|
.. seqdiag::
|
||||||
| app | | event | | Wi-Fi |
|
:caption: Foreground Scan of all Wi-Fi Channels
|
||||||
| task | | task | | task |
|
:align: center
|
||||||
--------- --------- ---------
|
|
||||||
| | |
|
seqdiag foreground-scan-all-channels {
|
||||||
| | |
|
activation = none;
|
||||||
| 1.1> Configure country code |
|
node_width = 80;
|
||||||
|-------------------------------------->|
|
node_height = 60;
|
||||||
| 1.2> Scan configuration |
|
edge_length = 160;
|
||||||
|-------------------------------------->|
|
span_height = 5;
|
||||||
| | |
|
default_shape = roundedbox;
|
||||||
| | |
|
default_fontsize = 12;
|
||||||
| | |----
|
|
||||||
| | | | 2.1> Scan channel 1
|
APP_TASK [label = "App\ntask"];
|
||||||
| | |<---
|
EVENT_TASK [label = "Event\ntask"];
|
||||||
| | |----
|
WIFI_TASK [label = "Wi-Fi\ntask"];
|
||||||
| | | | 2.2> Scan channel 2
|
|
||||||
| | |<---
|
APP_TASK -> WIFI_TASK [label="1.1 > Configure country code"];
|
||||||
| | |
|
APP_TASK -> WIFI_TASK [label="1.2 > Scan configuration"];
|
||||||
| | | .... ...
|
WIFI_TASK -> WIFI_TASK [label="2.1 > Scan channel 1"];
|
||||||
| | |
|
WIFI_TASK -> WIFI_TASK [label="2.2 > Scan channel 2"];
|
||||||
| | |----
|
WIFI_TASK -> WIFI_TASK [label="..."];
|
||||||
| | | | 2.x> Scan channel N
|
WIFI_TASK -> WIFI_TASK [label="2.x > Scan channel N"];
|
||||||
| | |<---
|
EVENT_TASK <- WIFI_TASK [label="3.1 > SYSTEM_EVENT_SCAN_DONE"];
|
||||||
| | |
|
APP_TASK <- EVENT_TASK [label="3.2 > SYSTEM_EVENT_SCAN_DONE"];
|
||||||
| 3.1 SYSTEM_EVENT_SCAN_DONE |
|
}
|
||||||
| |<------------------|
|
|
||||||
| 3.2 SYSTEM_EVENT_SCAN_DONE |
|
|
||||||
|<------------------| |
|
|
||||||
| | |
|
|
||||||
|
|
||||||
|
|
||||||
The scenario above describes an all-channel, foreground scan. The foreground scan can only occur in Station mode where the station does not connect to any AP. Whether it is a foreground or background scan is totally determined by the Wi-Fi driver, and cannot be configured by the application.
|
The scenario above describes an all-channel, foreground scan. The foreground scan can only occur in Station mode where the station does not connect to any AP. Whether it is a foreground or background scan is totally determined by the Wi-Fi driver, and cannot be configured by the application.
|
||||||
@ -574,84 +565,70 @@ Scan-Done Event Handling Phase
|
|||||||
|
|
||||||
Scan All APs on All Channels(background)
|
Scan All APs on All Channels(background)
|
||||||
++++++++++++++++++++++++++++++++++++++++
|
++++++++++++++++++++++++++++++++++++++++
|
||||||
Scenario::
|
Scenario:
|
||||||
|
|
||||||
--------- --------- ---------
|
.. seqdiag::
|
||||||
| app | | event | | Wi-Fi |
|
:caption: Background Scan of all Wi-Fi Channels
|
||||||
| task | | task | | task |
|
:align: center
|
||||||
--------- --------- ---------
|
|
||||||
| | |
|
seqdiag background-scan-all-channels {
|
||||||
| | |
|
activation = none;
|
||||||
| 1.1> Configure country code |
|
node_width = 80;
|
||||||
|-------------------------------------->|
|
node_height = 60;
|
||||||
| 1.2> Scan configuration |
|
edge_length = 160;
|
||||||
|-------------------------------------->|
|
span_height = 5;
|
||||||
| | |
|
default_shape = roundedbox;
|
||||||
| | |
|
default_fontsize = 12;
|
||||||
| | |----
|
|
||||||
| | | | 2.1> Scan channel 1
|
APP_TASK [label = "App\ntask"];
|
||||||
| | |<---
|
EVENT_TASK [label = "Event\ntask"];
|
||||||
| | |----
|
WIFI_TASK [label = "Wi-Fi\ntask"];
|
||||||
| | | | 2.2> Back to home channel H
|
|
||||||
| | |<---
|
APP_TASK -> WIFI_TASK [label="1.1 > Configure country code"];
|
||||||
| | |----
|
APP_TASK -> WIFI_TASK [label="1.2 > Scan configuration"];
|
||||||
| | | | 2.3> Scan channel 2
|
WIFI_TASK -> WIFI_TASK [label="2.1 > Scan channel 1"];
|
||||||
| | |<---
|
WIFI_TASK -> WIFI_TASK [label="2.2 > Back to home channel H"];
|
||||||
| | |----
|
WIFI_TASK -> WIFI_TASK [label="2.3 > Scan channel 2"];
|
||||||
| | | | 2.4> Back to home channel H
|
WIFI_TASK -> WIFI_TASK [label="2.4 > Back to home channel H"];
|
||||||
| | |<---
|
WIFI_TASK -> WIFI_TASK [label="..."];
|
||||||
| | |
|
WIFI_TASK -> WIFI_TASK [label="2.x-1 > Scan channel N"];
|
||||||
| | | .... ...
|
WIFI_TASK -> WIFI_TASK [label="2.x > Back to home channel H"];
|
||||||
| | |
|
EVENT_TASK <- WIFI_TASK [label="3.1 > SYSTEM_EVENT_SCAN_DONE"];
|
||||||
| | |----
|
APP_TASK <- EVENT_TASK [label="3.2 > SYSTEM_EVENT_SCAN_DONE"];
|
||||||
| | | | 2.x-1> Scan channel N
|
}
|
||||||
| | |<---
|
|
||||||
| | |----
|
|
||||||
| | | | 2.x> Back to home channel H
|
|
||||||
| | |<---
|
|
||||||
| | |
|
|
||||||
| 3.1 SYSTEM_EVENT_SCAN_DONE |
|
|
||||||
| |<------------------|
|
|
||||||
| 3.2 SYSTEM_EVENT_SCAN_DONE |
|
|
||||||
|<------------------| |
|
|
||||||
| | |
|
|
||||||
|
|
||||||
The scenario above is an all-channel background scan. Compared to `Scan All APs In All Channels(foreground)`_ , the difference in the all-channel background scan is that the Wi-Fi driver will scan the back-to-home channel for 30 ms before it switches to the next channel to give the Wi-Fi connection a chance to transmit/receive data.
|
The scenario above is an all-channel background scan. Compared to `Scan All APs In All Channels(foreground)`_ , the difference in the all-channel background scan is that the Wi-Fi driver will scan the back-to-home channel for 30 ms before it switches to the next channel to give the Wi-Fi connection a chance to transmit/receive data.
|
||||||
|
|
||||||
Scan for a Specific AP in All Channels
|
Scan for a Specific AP in All Channels
|
||||||
+++++++++++++++++++++++++++++++++++++++
|
+++++++++++++++++++++++++++++++++++++++
|
||||||
Scenario::
|
Scenario:
|
||||||
|
|
||||||
--------- --------- ---------
|
.. seqdiag::
|
||||||
| app | | event | | Wi-Fi |
|
:caption: Scan of specific Wi-Fi Channels
|
||||||
| task | | task | | task |
|
:align: center
|
||||||
--------- --------- ---------
|
|
||||||
| | |
|
seqdiag scan-specific-channels {
|
||||||
| | |
|
activation = none;
|
||||||
| 1.1> Configure country code |
|
node_width = 80;
|
||||||
|-------------------------------------->|
|
node_height = 60;
|
||||||
| 1.2> Scan configuration |
|
edge_length = 160;
|
||||||
|-------------------------------------->|
|
span_height = 5;
|
||||||
| | |
|
default_shape = roundedbox;
|
||||||
| | |
|
default_fontsize = 12;
|
||||||
| | |----
|
|
||||||
| | | | 2.1> Scan channel C1
|
APP_TASK [label = "App\ntask"];
|
||||||
| | |<---
|
EVENT_TASK [label = "Event\ntask"];
|
||||||
| | |----
|
WIFI_TASK [label = "Wi-Fi\ntask"];
|
||||||
| | | | 2.2> Scan channel C2
|
|
||||||
| | |<---
|
APP_TASK -> WIFI_TASK [label="1.1 > Configure country code"];
|
||||||
| | |
|
APP_TASK -> WIFI_TASK [label="1.2 > Scan configuration"];
|
||||||
| | | ...
|
WIFI_TASK -> WIFI_TASK [label="2.1 > Scan channel C1"];
|
||||||
| | |
|
WIFI_TASK -> WIFI_TASK [label="2.2 > Scan channel C2"];
|
||||||
| | |----
|
WIFI_TASK -> WIFI_TASK [label="..."];
|
||||||
| | | | 2.x> Scan channel CN, or the AP is found
|
WIFI_TASK -> WIFI_TASK [label="2.x > Scan channel CN, or the AP is found"];
|
||||||
| | |<---
|
EVENT_TASK <- WIFI_TASK [label="3.1 > SYSTEM_EVENT_SCAN_DONE"];
|
||||||
| | |
|
APP_TASK <- EVENT_TASK [label="3.2 > SYSTEM_EVENT_SCAN_DONE"];
|
||||||
| 3.1 SYSTEM_EVENT_SCAN_DONE |
|
}
|
||||||
| |<------------------|
|
|
||||||
| 3.2 SYSTEM_EVENT_SCAN_DONE |
|
|
||||||
|<------------------| |
|
|
||||||
| | |
|
|
||||||
|
|
||||||
This scan is similar to `Scan All APs In All Channels(foreground)`_. The differences are:
|
This scan is similar to `Scan All APs In All Channels(foreground)`_. The differences are:
|
||||||
|
|
||||||
@ -681,60 +658,50 @@ ESP32 Wi-Fi Station Connecting Scenario
|
|||||||
----------------------------------------
|
----------------------------------------
|
||||||
Generally, the application does not need to care about the connecting process. Below is a brief introduction to the process for those who are really interested.
|
Generally, the application does not need to care about the connecting process. Below is a brief introduction to the process for those who are really interested.
|
||||||
|
|
||||||
Scenario::
|
Scenario:
|
||||||
|
|
||||||
|
.. seqdiag::
|
||||||
|
:caption: Wi-Fi Station Connecting Process
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
seqdiag station-connecting-process {
|
||||||
|
activation = none;
|
||||||
|
node_width = 80;
|
||||||
|
node_height = 60;
|
||||||
|
edge_length = 160;
|
||||||
|
span_height = 5;
|
||||||
|
default_shape = roundedbox;
|
||||||
|
default_fontsize = 12;
|
||||||
|
|
||||||
|
EVENT_TASK [label = "Event\ntask"];
|
||||||
|
WIFI_TASK [label = "Wi-Fi\ntask"];
|
||||||
|
AP [label = "AP"];
|
||||||
|
|
||||||
|
=== 1. Scan Phase ===
|
||||||
|
WIFI_TASK -> WIFI_TASK [label="1.1 > Scan"];
|
||||||
|
EVENT_TASK <- WIFI_TASK [label="1.2 > SYSTEM_EVENT_STA_DISCONNECTED"];
|
||||||
|
=== 2. Auth Phase ===
|
||||||
|
WIFI_TASK -> AP [label="2.1 > Auth request"];
|
||||||
|
EVENT_TASK <- WIFI_TASK [label="2.2 > SYSTEM_EVENT_STA_DISCONNECTED"];
|
||||||
|
WIFI_TASK <- AP [label="2.3 > Auth response"];
|
||||||
|
EVENT_TASK <- WIFI_TASK [label="2.4 > SYSTEM_EVENT_STA_DISCONNECTED"];
|
||||||
|
=== 3. Assoc Phase ===
|
||||||
|
WIFI_TASK -> AP [label="3.1 > Assoc request"];
|
||||||
|
EVENT_TASK <- WIFI_TASK [label="3.2 > SYSTEM_EVENT_STA_DISCONNECTED"];
|
||||||
|
WIFI_TASK <- AP [label="3.3 > Assoc response"];
|
||||||
|
EVENT_TASK <- WIFI_TASK [label="3.4 > SYSTEM_EVENT_STA_DISCONNECTED"];
|
||||||
|
=== 4. 4-way Handshake Phase ===
|
||||||
|
WIFI_TASK -> AP [label="4.1 > 1/4 EAPOL"];
|
||||||
|
EVENT_TASK <- WIFI_TASK [label="4.2 > SYSTEM_EVENT_STA_DISCONNECTED"];
|
||||||
|
WIFI_TASK -> AP [label="4.3 > 2/4 EAPOL"];
|
||||||
|
EVENT_TASK <- WIFI_TASK [label="4.4 > SYSTEM_EVENT_STA_DISCONNECTED"];
|
||||||
|
WIFI_TASK -> AP [label="4.5 > 3/4 EAPOL"];
|
||||||
|
EVENT_TASK <- WIFI_TASK [label="4.6 > SYSTEM_EVENT_STA_DISCONNECTED"];
|
||||||
|
WIFI_TASK -> AP [label="4.7 > 4/4 EAPOL"];
|
||||||
|
EVENT_TASK <- WIFI_TASK [label="4.8 > SYSTEM_EVENT_STA_DISCONNECTED"];
|
||||||
|
EVENT_TASK <- WIFI_TASK [label="4.9 > SYSTEM_EVENT_STA_DISCONNECTED"];
|
||||||
|
}
|
||||||
|
|
||||||
--------- --------- ---------
|
|
||||||
| Event | | Wi-Fi | | AP |
|
|
||||||
| task | | task | | |
|
|
||||||
--------- --------- ---------
|
|
||||||
| | |
|
|
||||||
| | | ---
|
|
||||||
| |---- | |
|
|
||||||
| | | 1.1> Scan |
|
|
||||||
| |<--- | Scan phase
|
|
||||||
| 1.2> SYSTEM_EVENT_STA_DISCONNECTED |
|
|
||||||
|<------------------| | |
|
|
||||||
| | | ---
|
|
||||||
| | | |
|
|
||||||
| 2.1> Auth Request | |
|
|
||||||
| |------------------>| |
|
|
||||||
| 2.2> SYSTEM_EVENT_STA_DISCONNECTED |
|
|
||||||
|<------------------| | Auth phase
|
|
||||||
| 2.3> Auth Response |
|
|
||||||
| |<------------------| |
|
|
||||||
| 2.4> SYSTEM_EVENT_STA_DISCONNECTED | |
|
|
||||||
|<------------------| | ---
|
|
||||||
| | | |
|
|
||||||
| | 3.1 Assoc Request | |
|
|
||||||
| |------------------>| |
|
|
||||||
| 3.2> SYSTEM_EVENT_STA_DISCONNECTED |
|
|
||||||
|<------------------| | Assoc phase
|
|
||||||
| 3.3 Assoc Response |
|
|
||||||
| |<------------------| |
|
|
||||||
| 3.4> SYSTEM_EVENT_STA_DISCONNECTED | |
|
|
||||||
|<------------------| | |
|
|
||||||
| | | ---
|
|
||||||
| | | |
|
|
||||||
| | 4.1> 1/4 EAPOL | |
|
|
||||||
| |<------------------| |
|
|
||||||
| 4.2> SYSTEM_EVENT_STA_DISCONNECTED | |
|
|
||||||
|<------------------| | |
|
|
||||||
| | 4.3> 2/4 EAPOL | |
|
|
||||||
| |------------------>| |
|
|
||||||
| 4.4> SYSTEM_EVENT_STA_DISCONNECTED |
|
|
||||||
|<------------------| | 4-way handshake phase
|
|
||||||
| | 4.5> 3/4 EAPOL |
|
|
||||||
| |<------------------| |
|
|
||||||
| 4.6> SYSTEM_EVENT_STA_DISCONNECTED | |
|
|
||||||
|<------------------| | |
|
|
||||||
| | 4.7> 4/4 EAPOL | |
|
|
||||||
| |------------------>| |
|
|
||||||
| 4.8> SYSTEM_EVENT_STA_DISCONNECTED | |
|
|
||||||
|<------------------| | |
|
|
||||||
| | | |
|
|
||||||
| 4.9> SYSTEM_EVENT_STA_DISCONNECTED | |
|
|
||||||
|<------------------| | ---
|
|
||||||
| | |
|
|
||||||
|
|
||||||
Scan Phase
|
Scan Phase
|
||||||
+++++++++++++++++++++
|
+++++++++++++++++++++
|
||||||
@ -1598,26 +1565,73 @@ Wi-Fi Menuconfig
|
|||||||
Wi-Fi Buffer Configure
|
Wi-Fi Buffer Configure
|
||||||
+++++++++++++++++++++++
|
+++++++++++++++++++++++
|
||||||
|
|
||||||
If you are going to modify the default number or type of buffer, it would be helpful to also have an overview of how the buffer is allocated/freed in the data path. The following diagram shows this process in the TX direction::
|
If you are going to modify the default number or type of buffer, it would be helpful to also have an overview of how the buffer is allocated/freed in the data path. The following diagram shows this process in the TX direction:
|
||||||
|
|
||||||
|
.. blockdiag::
|
||||||
|
:caption: TX Buffer Allocation
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
blockdiag buffer_allocation_tx {
|
||||||
|
|
||||||
|
# global attributes
|
||||||
|
node_height = 60;
|
||||||
|
node_width = 100;
|
||||||
|
span_width = 50;
|
||||||
|
span_height = 20;
|
||||||
|
default_shape = roundedbox;
|
||||||
|
|
||||||
|
# labels of diagram nodes
|
||||||
|
APPL_TASK [label="Application\n task", fontsize=12];
|
||||||
|
LWIP_TASK [label="LwIP\n task", fontsize=12];
|
||||||
|
WIFI_TASK [label="Wi-Fi\n task", fontsize=12];
|
||||||
|
|
||||||
|
# labels of description nodes
|
||||||
|
APPL_DESC [label="1> User data", width=120, height=25, shape=note, color=yellow];
|
||||||
|
LWIP_DESC [label="2> Pbuf", width=120, height=25, shape=note, color=yellow];
|
||||||
|
WIFI_DESC [label="3> Dynamic (Static)\n TX Buffer", width=150, height=40, shape=note, color=yellow];
|
||||||
|
|
||||||
|
# node connections
|
||||||
|
APPL_TASK -> LWIP_TASK -> WIFI_TASK
|
||||||
|
APPL_DESC -> LWIP_DESC -> WIFI_DESC [style=none]
|
||||||
|
}
|
||||||
|
|
||||||
------------- ------------- -------------
|
|
||||||
| Application | | LwIP | | Wi-Fi |
|
|
||||||
| task | ---------> | task | ---------> | task |
|
|
||||||
------------- ------------- -------------
|
|
||||||
1> User data 2> Pbuf 3> Dynamic (Static) TX Buffer
|
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
- The application allocates the data which needs to be sent out.
|
- The application allocates the data which needs to be sent out.
|
||||||
- The application calls TCPIP-/Socket-related APIs to send the user data. These APIs will allocate a PBUF used in LwIP, and make a copy of the user data.
|
- The application calls TCPIP-/Socket-related APIs to send the user data. These APIs will allocate a PBUF used in LwIP, and make a copy of the user data.
|
||||||
- When LwIP calls a Wi-Fi API to send the PBUF, the Wi-Fi API will allocate a "Dynamic Tx Buffer" or "Static Tx Buffer", make a copy of the LwIP PBUF, and finally send the data.
|
- When LwIP calls a Wi-Fi API to send the PBUF, the Wi-Fi API will allocate a "Dynamic Tx Buffer" or "Static Tx Buffer", make a copy of the LwIP PBUF, and finally send the data.
|
||||||
|
|
||||||
The following diagram shows how buffer is allocated/freed in the RX direction::
|
The following diagram shows how buffer is allocated/freed in the RX direction:
|
||||||
|
|
||||||
------------- ------------- ------------- -------------
|
.. blockdiag::
|
||||||
| Application | | LwIP | | Wi-Fi | | Wi-Fi |
|
:caption: RX Buffer Allocation
|
||||||
| Task | <--------- | task | <--------- | task | <--------- | Interrupt |
|
:align: center
|
||||||
------------- ------------- ------------- -------------
|
|
||||||
4> User data 3> Pbuf 2> Dynamic RX Buffer 1> Static RX Buffer
|
blockdiag buffer_allocation_rx {
|
||||||
|
|
||||||
|
# global attributes
|
||||||
|
node_height = 60;
|
||||||
|
node_width = 100;
|
||||||
|
span_width = 40;
|
||||||
|
span_height = 20;
|
||||||
|
default_shape = roundedbox;
|
||||||
|
|
||||||
|
# labels of diagram nodes
|
||||||
|
APPL_TASK [label="Application\n task", fontsize=12];
|
||||||
|
LWIP_TASK [label="LwIP\n task", fontsize=12];
|
||||||
|
WIFI_TASK [label="Wi-Fi\n task", fontsize=12];
|
||||||
|
WIFI_INTR [label="Wi-Fi\n interrupt", fontsize=12];
|
||||||
|
|
||||||
|
# labels of description nodes
|
||||||
|
APPL_DESC [label="4> User\n Data Buffer", height=40, shape=note, color=yellow];
|
||||||
|
LWIP_DESC [label="3> Pbuf", height=40, shape=note, color=yellow];
|
||||||
|
WIFI_DESC [label="2> Dynamic\n RX Buffer", height=40, shape=note, color=yellow];
|
||||||
|
INTR_DESC [label="1> Static\n RX Buffer", height=40, shape=note, color=yellow];
|
||||||
|
|
||||||
|
# node connections
|
||||||
|
APPL_TASK <- LWIP_TASK <- WIFI_TASK <- WIFI_INTR
|
||||||
|
APPL_DESC <- LWIP_DESC <- WIFI_DESC <- INTR_DESC [style=none]
|
||||||
|
}
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user