mirror of
https://github.com/espressif/esptool.git
synced 2025-10-20 22:09:59 +08:00
docs(serial-protocol): add images and flowchart
This commit is contained in:
13
docs/en/advanced-topics/diag/command_packet_format.diag
Normal file
13
docs/en/advanced-topics/diag/command_packet_format.diag
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
packetdiag command_packet_format{
|
||||||
|
colwidth = 16
|
||||||
|
node_width = 50
|
||||||
|
node_height = 50
|
||||||
|
default_fontsize = 16
|
||||||
|
|
||||||
|
0: "0x00";
|
||||||
|
1: "Cmd";
|
||||||
|
2-3: "Size";
|
||||||
|
4-7: "Checksum";
|
||||||
|
8-15: "Data" [color = lightgrey];
|
||||||
|
16-31: "..." [color = lightgrey];
|
||||||
|
}
|
39
docs/en/advanced-topics/diag/download_procedure_chart.diag
Normal file
39
docs/en/advanced-topics/diag/download_procedure_chart.diag
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
blockdiag download_procedure_diagram {
|
||||||
|
node_height = 40;
|
||||||
|
node_width = 150;
|
||||||
|
span_width = 40;
|
||||||
|
span_height = 45;
|
||||||
|
default_fontsize = 12
|
||||||
|
orientation = portrait;
|
||||||
|
edge_layout = flowchart;
|
||||||
|
default_group_color = none;
|
||||||
|
|
||||||
|
// nodes
|
||||||
|
start [label = "Start", shape = flowchart.terminator];
|
||||||
|
sync [label = "Synchronization", shape = box];
|
||||||
|
success_cond [label = "Success?", shape = flowchart.condition];
|
||||||
|
erase_data [label = "Erase data", shape = box];
|
||||||
|
transmit_data [label = "Transmit data", shape = box];
|
||||||
|
finish_cond [label = "Finish?", shape = flowchart.condition];
|
||||||
|
transmit_finish [label = "Transmit finish frame", shape = box];
|
||||||
|
finish [label = "Finish", shape = flowchart.terminator];
|
||||||
|
// fake nodes to adjust shape and edge label position
|
||||||
|
succ_fin [shape = none];
|
||||||
|
fincon_fin [shape = none];
|
||||||
|
|
||||||
|
// edges
|
||||||
|
start -> sync -> success_cond;
|
||||||
|
success_cond -> erase_data [label = "Yes"];
|
||||||
|
erase_data -> transmit_data;
|
||||||
|
transmit_data -> finish_cond;
|
||||||
|
success_cond -- succ_fin [label = "Timeout"];
|
||||||
|
finish_cond -> transmit_finish [label = "Yes"];
|
||||||
|
finish_cond -- fincon_fin [label = "Failure"];
|
||||||
|
succ_fin -- fincon_fin;
|
||||||
|
fincon_fin -> finish;
|
||||||
|
transmit_finish -> finish;
|
||||||
|
|
||||||
|
// group
|
||||||
|
group{transmit_finish, fincon_fin};
|
||||||
|
group{erase_data, succ_fin};
|
||||||
|
}
|
13
docs/en/advanced-topics/diag/response_packet_format.diag
Normal file
13
docs/en/advanced-topics/diag/response_packet_format.diag
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
packetdiag command_packet_format{
|
||||||
|
colwidth = 16
|
||||||
|
node_width = 50
|
||||||
|
node_height = 50
|
||||||
|
default_fontsize = 16
|
||||||
|
|
||||||
|
0: "0x01";
|
||||||
|
1: "Cmd";
|
||||||
|
2-3: "Size";
|
||||||
|
4-7: "Value";
|
||||||
|
8-15: "Data" [color = lightgrey];
|
||||||
|
16-31: "..." [color = lightgrey];
|
||||||
|
}
|
@@ -27,7 +27,7 @@ The host computer sends a SLIP encoded command request to the ESP chip. The ESP
|
|||||||
Low Level Protocol
|
Low Level Protocol
|
||||||
^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The bootloader protocol uses `SLIP <http://en.wikipedia.org/wiki/SLIP>`_ packet framing for data transmissions in both directions.
|
The bootloader protocol uses `SLIP <https://en.wikipedia.org/wiki/Serial_Line_Internet_Protocol>`_ packet framing for data transmissions in both directions.
|
||||||
|
|
||||||
Each SLIP packet begins and ends with ``0xC0``. Within the packet, all occurrences of ``0xC0`` and ``0xDB`` are replaced with ``0xDB 0xDC`` and ``0xDB 0xDD``, respectively. The replacing is to be done **after** the checksum and lengths are calculated, so the packet length may be longer than the ``size`` field below.
|
Each SLIP packet begins and ends with ``0xC0``. Within the packet, all occurrences of ``0xC0`` and ``0xDB`` are replaced with ``0xDB 0xDC`` and ``0xDB 0xDD``, respectively. The replacing is to be done **after** the checksum and lengths are calculated, so the packet length may be longer than the ``size`` field below.
|
||||||
|
|
||||||
@@ -36,6 +36,11 @@ Command Packet
|
|||||||
|
|
||||||
Each command is a SLIP packet initiated by the host and results in a response packet. Inside the packet, the packet consists of a header and a variable-length body. All multi-byte fields are little-endian.
|
Each command is a SLIP packet initiated by the host and results in a response packet. Inside the packet, the packet consists of a header and a variable-length body. All multi-byte fields are little-endian.
|
||||||
|
|
||||||
|
.. packetdiag:: diag/command_packet_format.diag
|
||||||
|
:caption: Command packet format
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
|
||||||
+--------+-------------+--------------------------------------------------------------------------------------------------------------------+
|
+--------+-------------+--------------------------------------------------------------------------------------------------------------------+
|
||||||
| Byte | Name | Comment |
|
| Byte | Name | Comment |
|
||||||
+========+=============+====================================================================================================================+
|
+========+=============+====================================================================================================================+
|
||||||
@@ -55,6 +60,10 @@ Response Packet
|
|||||||
|
|
||||||
Each received command will result in a response SLIP packet sent from the ESP chip to the host. Contents of the response packet is:
|
Each received command will result in a response SLIP packet sent from the ESP chip to the host. Contents of the response packet is:
|
||||||
|
|
||||||
|
.. packetdiag:: diag/response_packet_format.diag
|
||||||
|
:caption: Command packet format
|
||||||
|
:align: center
|
||||||
|
|
||||||
+--------+-------------+--------------------------------------------------------------------------------------------------------------+
|
+--------+-------------+--------------------------------------------------------------------------------------------------------------+
|
||||||
| Byte | Name | Comment |
|
| Byte | Name | Comment |
|
||||||
+========+=============+==============================================================================================================+
|
+========+=============+==============================================================================================================+
|
||||||
@@ -270,7 +279,7 @@ ROM loaders will not recognise these commands.
|
|||||||
Checksum
|
Checksum
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
The checksum field is ignored (can be zero) for all comands except for MEM_DATA, FLASH_DATA, and FLASH_DEFL_DATA.
|
The checksum field is ignored (can be zero) for all commands except for MEM_DATA, FLASH_DATA, and FLASH_DEFL_DATA.
|
||||||
|
|
||||||
Each of the ``_DATA`` command packets (like ``FLASH_DEFL_DATA``, ``MEM_DATA``) has the same "data payload" format:
|
Each of the ``_DATA`` command packets (like ``FLASH_DEFL_DATA``, ``MEM_DATA``) has the same "data payload" format:
|
||||||
|
|
||||||
@@ -297,6 +306,14 @@ To calculate checksum, start with seed value 0xEF and XOR each individual byte i
|
|||||||
Functional Description
|
Functional Description
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
.. blockdiag:: diag/download_procedure_chart.diag
|
||||||
|
:caption: Download procedure flow chart
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
This flow chart is used to illustrate the download procedure (writing to flash), other commands have different flows.
|
||||||
|
|
||||||
Initial Synchronisation
|
Initial Synchronisation
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
.. list::
|
.. list::
|
||||||
|
Reference in New Issue
Block a user