Skip to content

Commit 042587a

Browse files
author
Amanda Butler
authored
Merge pull request #843 from jarvte/cellular_update_to_511
Cellular: update handbook to 5.11
2 parents 8c263e6 + 808325d commit 042587a

File tree

5 files changed

+38
-20
lines changed

5 files changed

+38
-20
lines changed

docs/api/networkinterfaces/CellularInterface.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,9 @@
22

33
<span class="images">![](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_cellular_base.png)<span>CellularBase class hierarchy</span></span>
44

5-
The CellularBase provides a C++ API for connecting to the internet over a Cellular device.
6-
7-
Arm Mbed OS provides a [reference implementation of CellularBase](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_easy_cellular_connection_8h_source.html), which has more information.
8-
9-
#### Cellular
10-
115
The [CellularBase](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_cellular_base_8h_source.html) provides a C++ API for connecting to the internet over a Cellular device.
126

13-
Arm Mbed OS provides a [reference implementation of CellularBase](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_easy_cellular_connection_8h_source.html).
7+
Arm Mbed OS provides a [reference implementation of CellularBase](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_cellular_context_8h_source.html), which has more information.
148

159
##### Getting started
1610

@@ -48,7 +42,7 @@ You can use and extend a cellular interface in various different ways. For examp
4842

4943
<span class="images">![](https://s3-us-west-2.amazonaws.com/mbed-os-docs-images/Cell_PPP.png)</span>
5044

51-
[`mbed-os-example-cellular`](https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-cellular/) uses [an easy cellular connection](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_easy_cellular_connection_8h_source.html). It depends on the modem whether the application uses PPP or AT mode. We can summarize this particular design as follows:
45+
[`mbed-os-example-cellular`](https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-cellular/) uses PPP or AT mode depending on the modem. We can summarize this particular design as follows:
5246

5347
- It uses an external IP stack, such as LWIP, or on-chip network stacks such as when the modem does not support PPP.
5448
- The easy cellular connection uses standard 3GPP AT 27.007 AT commands to set up the cellular modem and to register to the network.
628 Bytes
Loading

docs/porting/connectivity/CellularInterface.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ If your cellular module has an IP stack, you need to implement the AT commands t
8686

8787
For example implementations of a socket adaptation, look in `features/cellular/framework/targets`.
8888

89-
When the modem has AT and/or PPP mode support in place and the application developer has selected which mode to use, it's up to the cellular framework to instantiate the correct classes. For example, [mbed-os-example-cellular](https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-cellular/) instantiates [EasyCellularConnection class](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_easy_cellular_connection_8h_source.html), which in turn instantiates [CellularConnectionFSM class](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_cellular_connection_f_s_m_8h_source.html). CellularConnectionFSM instantiates classes implementing [the AT command layer](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_a_t___cellular_device_8h_source.html) between the modem and the Mbed OS CPU. If an application developer has configured PPP mode in `mbed_app.json` then [AT_CellularNetwork](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_a_t___cellular_network_8h_source.html) connects to a cellular network and calls `nsapi_ppp_connect()` to start the data call through the PPP pipe using LWIP sockets.
89+
When the modem has AT and/or PPP mode support in place and the application developer has selected which mode to use, it's up to the cellular framework to instantiate the correct classes. For example, [mbed-os-example-cellular](https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-cellular/) instantiates [CellularContext class](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_cellular_context_8h_source.html). CellularContext instantiates classes implementing [the AT command layer](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_a_t___cellular_device_8h_source.html) between the modem and the Mbed OS CPU. If an application developer has configured PPP mode in `mbed_app.json` then [AT_CellularContext](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_a_t___cellular_context_8h_source.html) connects to a cellular network and calls `nsapi_ppp_connect()` to start the data call through the PPP pipe using LWIP sockets.
9090

9191
### Testing
9292

docs/reference/configuration/Connectivity.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ Example application code can be as simple as:
191191
if (!net) {
192192
// There is no default...
193193
}
194-
net->connet();
194+
net->connect();
195195
```
196196

197197
Boards that provide only Ethernet connectivity do not require any configuration. The default settings are sufficient. Boards that provide other connectivity options require selecting the default interface type and providing settings for it.
@@ -223,6 +223,12 @@ Name: nsapi.default-wifi-ssid
223223
Name: nsapi.default-wifi-password
224224
Defined by: library:nsapi
225225
No value set
226+
Name: nsapi.default-cellular-plmn
227+
Defined by: library:nsapi
228+
No value set
229+
Name: nsapi.default-cellular-sim-pin
230+
Defined by: library:nsapi
231+
No value set
226232
Name: nsapi.default-cellular-apn
227233
Defined by: library:nsapi
228234
No value set

docs/reference/technology/connectivity/cellular.md

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ There are two phases to Mbed OS connectivity, in general:
2727
1. Connect to a network.
2828
1. Open a socket to send or receive data.
2929

30-
With cellular, the easiest way to connect your application to the internet over a cellular network is to use the `CellularConnectionFSM` class. It encapsulates most of the complexity of connecting to the cellular network and also reports any changes in connection status to your application. When connected to a cellular network, you can use Mbed OS network sockets as usual, as Figure 2 illustrates.
30+
With cellular, the easiest way to connect your application to the internet over a cellular network is to use the `CellularContext` class and `get_default_instance`. It encapsulates most of the complexity of connecting to the cellular network and also reports any changes in connection status to your application. When connected to a cellular network, you can use Mbed OS network sockets as usual, as Figure 2 illustrates.
3131

3232
<span class="images">![](https://s3-us-west-2.amazonaws.com/mbed-os-docs-images/api-cellular-quick-start.png)<span>Figure 2. Connect to cellular network and open a socket</span></span>
3333

@@ -48,33 +48,51 @@ If you use an Mbed OS target and a separate cellular hosted module via a serial
4848
[
4949
"CELLULAR_DEVICE=<manufacturer-module>",
5050
"MDMRXD=<rx-pin-name>",
51-
"MDMTXD=<tx-pin-name>"
51+
"MDMTXD=<tx-pin-name>",
52+
"MDMRTS=<rts-pin-name>",
53+
"MDMCTS=<cts-pin-name>"
5254
]
53-
}
55+
}
5456

55-
You need to change the pin-names above to actual pins, such as D0 and D1, according to your Mbed target. You may also need to define MDMRTS and MDMCTS pins if you have RTS/CTS connected on UART.
57+
You need to change the pin names above to actual pins, such as D0 and D1, according to your Mbed target. You may also need to define MDMRTS and MDMCTS pins if you have RTS and CTS connected on UART. If RTC and CTS are not connected on UART, then define MDMRTS and MDMCTS as `NC`.
5658

5759
### Cellular APIs
5860

59-
As an application developer, you should use and refer only to classes located under API folder. All the other classes have implementation details which are expected to change frequently.
61+
As an application developer, you should use and refer only to classes located under API folder. All the other classes have implementation details that are expected to change frequently.
6062

6163
Cellular APIs are structured based on main functionalities:
6264

63-
- `CellularNetwork` for cellular network features, such as preferred operator and APN.
65+
- `CellularContext` is the main interface for the application. You can use it to connect to the operator's Access Point Name (APN).
66+
- `CellularNetwork` for cellular network features, such as registering and attaching to a network.
6467
- `CellularPower` for cellular hosted module power control, such as enabling power save.
6568
- `CellularInformation` to read the cellular hosted module type and firmware version.
6669
- `CellularSIM` to enter the PIN code and other SIM management functions.
6770
- `CellularSMS` to read and write SMS messages.
6871

72+
You can instantiate the CellularContext class with `CellularContext::get_default_instance()`, which opens `CellularDevice` and, through the device, opens `CellularContext`. Opening `CellularContext` through `get_default_instance` uses values from `mbed_app.json`.
73+
These values are not defined by default, and you must override them in `mbed_app.json` if you need them:
74+
75+
"target_overrides": {
76+
"*": {
77+
"nsapi.default-cellular-plmn": "\"12346\"",
78+
"nsapi.default-cellular-sim-pin": "\"1234\"",
79+
"nsapi.default-cellular-apn": "\"internet\"",
80+
"nsapi.default-cellular-username": 0,
81+
"nsapi.default-cellular-password": 0
82+
}
83+
}
84+
6985
The CellularDevice class encloses cellular APIs. Therefore, to use any cellular API, you need to get CellularDevice first. You can then use CellularDevice to open and close cellular APIs, as Figure 3 illustrates.
7086

7187
<span class="images">![](https://s3-us-west-2.amazonaws.com/mbed-os-docs-images/api-cellular-device.png)<span>Figure 3. Use CellularDevice to open Cellular APIs</span></span>
7288

7389
When an application has opened a cellular API, you can use it to request API methods. For example:
7490

75-
CellularNetwork *network = cellularDevice->get_network();
76-
if (network) {
77-
printf("Local IP address is %s", network->get_ip_address());
91+
CellularContext *ctx = cellularDevice->create_context();
92+
if (ctx) {
93+
if (ctx-connect() == NSAPI_ERROR_OK) {
94+
printf("Local IP address is %s", ctx->get_ip_address());
95+
}
7896
}
7997

8098
### UDP and TCP sockets
@@ -119,7 +137,7 @@ Consider the following points when selecting PPP or AT mode:
119137

120138
### Optimize for power consumption
121139

122-
The `CellularPower` class has methods to optimize power saving. The `set_powerl_level()` offers flexibility to control the reception and transmission power levels. In addition, 3GPP has specified advanced power optimizations that are useful for celluar IoT devices: Power Save Mode (PSM) and extended Discontinuous Reception (eDRX).
140+
The `CellularPower` class has methods to optimize power saving. The `set_power_level()` offers flexibility to control the reception and transmission power levels. In addition, 3GPP has specified advanced power optimizations that are useful for celluar IoT devices: Power Save Mode (PSM) and extended Discontinuous Reception (eDRX).
123141

124142
#### PSM - Power Save Mode
125143

0 commit comments

Comments
 (0)