Skip to content

Commit f67511c

Browse files
authored
Merge pull request #275 from gabsuren/docs/esp_modem_docs
docs(esp_modem): updated documents to show missed topics
2 parents 18ea910 + 0534853 commit f67511c

File tree

10 files changed

+255
-137
lines changed

10 files changed

+255
-137
lines changed

components/esp_modem/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ Get started with one of the examples:
1717

1818
## Documentation
1919

20-
* Continue with esp-modem [brief overview](docs/README.md)
21-
* View the full [html documentation](https://espressif.github.io/esp-protocols/esp_modem/index.html)
20+
* Continue with esp-modem [brief overview](https://github.com/espressif/esp-protocols/tree/master/docs/esp_modem/en/README.rst)
21+
* View the full [html documentation](https://docs.espressif.com/projects/esp-protocols/esp_modem/docs/latest/index.html)

docs/esp_modem/README.md

Lines changed: 0 additions & 92 deletions
This file was deleted.
File renamed without changes.

docs/esp_modem/en/README.rst

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
ESP MODEM
2+
=========
3+
4+
This component is used to communicate with modems in the command mode
5+
(using AT commands), as well as the data mode (over PPPoS protocol). The
6+
modem device is modeled with a DCE (Data Communication Equipment)
7+
object, which is composed of:
8+
9+
- DTE (Data Terminal Equipment), which abstracts the terminal (currently only UART implemented).
10+
- PPP Netif representing a network interface communicating with the DTE using PPP protocol.
11+
- Module abstracting the specific device model and its commands.
12+
13+
::
14+
15+
+-----+
16+
| DTE |--+
17+
+-----+ | +-------+
18+
+-->| DCE |
19+
+-------+ | |o--- set_mode(command/data)
20+
| Module|--->| |
21+
+-------+ | |o--- send_commands
22+
+->| |
23+
+------+ | +-------+
24+
| PPP |--+
25+
| netif|------------------> network events
26+
+------+
27+
28+
Modem components
29+
----------------
30+
31+
DCE
32+
~~~
33+
34+
This is the basic operational unit of the esp_modem component,
35+
abstracting a specific module in software, which is basically configured
36+
by
37+
38+
- the I/O communication media (UART), defined by the DTE configuration
39+
- the specific command library supported by the device model, defined with the module type
40+
- network interface configuration (PPPoS config in lwip)
41+
42+
After the object is created, the application interaction with the DCE is
43+
in
44+
45+
- issuing specific commands to the modem
46+
- switching between data and command mode
47+
48+
DTE
49+
~~~
50+
51+
Is an abstraction of the physical interface connected to the modem.
52+
Current implementation supports only UART
53+
54+
PPP netif
55+
~~~~~~~~~
56+
57+
Is used to attach the specific network interface to a network
58+
communication protocol used by the modem. Currently implementation
59+
supports only PPPoS protocol.
60+
61+
Module
62+
~~~~~~
63+
64+
Abstraction of the specific modem device. Currently the component
65+
supports SIM800, BG96, SIM7600.
66+
67+
Use cases
68+
---------
69+
70+
Users interact with the esp-modem using the DCE’s interface, to
71+
basically
72+
73+
- Switch between command and data mode to connect to the internet via cellular network.
74+
- Send various commands to the device (e.g. send SMS)
75+
76+
The applications typically register handlers for network events to
77+
receive notification on the network availability and IP address changes.
78+
79+
Common use cases of the esp-modem are also listed as the examples:
80+
81+
- ``examples/pppos_client`` – simple client which reads some module properties and switches to the data mode to connect to a public mqtt broker.
82+
- ``examples/modem_console`` – is an example to exercise all possible module commands in a console application.
83+
- ``examples/ap_to_pppos`` – this example focuses on the network
84+
connectivity of the esp-modem and provides a WiFi AP that forwards
85+
packets (and uses NAT) to and from the PPPoS connection.
86+
87+
Extensibility
88+
-------------
89+
90+
CMUX
91+
~~~~
92+
93+
Implementation of virtual terminals is an experimental feature, which
94+
allows users to also issue commands in the data mode, after creating
95+
multiple virtual terminals, designating some of them solely to data
96+
mode, others solely to command mode.
97+
98+
DTE’s
99+
~~~~~
100+
101+
Currently, we support only UART (and USB as a preview feature), but
102+
modern modules support other communication interfaces, such as USB, SPI.
103+
104+
Other devices
105+
~~~~~~~~~~~~~
106+
107+
Adding a new device is a must-have requirement for the esp-modem
108+
component. Different modules support different commands, or some
109+
commands might have a different implementation. Adding a new device
110+
means to provide a new implementation as a class derived from
111+
``GenericModule``, where we could add new commands or modify the
112+
existing ones.
113+
114+
Configuration
115+
-------------
116+
117+
Modem abstraction is configurable both compile-time and run-time.
118+
119+
Component Kconfig
120+
~~~~~~~~~~~~~~~~~
121+
122+
Compile-time configuration is provided using menuconfig. Please check
123+
the description for the CMUX mode configuration options.
124+
125+
Runtime configuration
126+
~~~~~~~~~~~~~~~~~~~~~
127+
128+
Is defined using standard configuration structures for ``DTE`` and
129+
``DCE`` objects separately. Please find documentation of
130+
131+
- :cpp:class:``esp_modem_dte_config_t``
132+
- :cpp:class:``esp_modem_dce_config_t``

docs/esp_modem/en/internal_design.md

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
Internal design
2+
===============
3+
4+
Design decisions
5+
----------------
6+
7+
- Use C++ with additional C API
8+
9+
- Use exceptions
10+
11+
- Use macro wrapper over ``try-catch`` blocks when exceptions off
12+
(use ``abort()`` if ``THROW()``)
13+
14+
- Initializes and allocates in the constructor (might throw)
15+
16+
- easier code with exceptions ON, with exceptions OFF alloc/init
17+
failures are not treated as runtime error (program aborts)
18+
- break down long initialization in constructor into more private
19+
methods
20+
21+
- Implements different devices using inheritance from
22+
``GenericModule``, which is the most general implementation of a
23+
common modem
24+
25+
- Internally uses templates with device specialization (modeled as
26+
``DCE<SpecificModule>``) which could be used as well for some
27+
special cases, such as implantation of a minimal device
28+
(ModuleIf), add new AT commands (oOnly in compile time), or using
29+
the Module with DTE only (no DCE, no Netif) for sending AT
30+
commands without network
31+
32+
DCE collaboration model
33+
-----------------------
34+
35+
The diagram describes how the DCE class collaborates with DTE, PPP and
36+
the device abstraction
37+
38+
.. figure:: DCE_DTE_collaboration.png
39+
:alt: DCE_architecture
40+
41+
DCE_architecture
42+
43+
Terminal inheritance
44+
--------------------
45+
46+
Terminal is a class which can read or write data, and can handle
47+
callbacks when data are available. UART specialization is provided
48+
implementing these method using the uart driver.
49+
50+
CMUX terminal
51+
-------------
52+
53+
The below diagram depicts the idea of using CMUX terminal mode using the
54+
CMuxInstance class which is a terminal (it implements the basic
55+
read/write methods) interfacing arbitrary number of virtual terminals,
56+
but at the same time it is also composed of CMux class, which consumes
57+
the original terminal and uses its read/write methods to multiplex the
58+
terminal.
59+
60+
.. figure:: CMux_collaboration.png
61+
:alt: CMUX Terminal
62+
63+
CMUX Terminal

components/esp_modem/include/generate/esp_modem_command_declare.inc renamed to docs/esp_modem/esp_modem_command_declare.inc

File renamed without changes.

components/esp_modem/include/generate/esp_modem_command_declare_helper.inc renamed to docs/esp_modem/esp_modem_command_declare_helper.inc

File renamed without changes.

0 commit comments

Comments
 (0)