Skip to content

Commit c8500ab

Browse files
author
Teppo Järvelin
committed
Cellular: update handbook to 5.11
1 parent b1b11d5 commit c8500ab

File tree

5 files changed

+37
-14
lines changed

5 files changed

+37
-14
lines changed

docs/api/networkinterfaces/CellularInterface.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
The CellularBase provides a C++ API for connecting to the internet over a Cellular device.
66

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.
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.
88

99
#### Cellular
1010

1111
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.
1212

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).
13+
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).
1414

1515
##### Getting started
1616

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

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

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:
51+
[`mbed-os-example-cellular`](https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-cellular/) uses [a class CellularContext](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_cellular_context_8h_source.html). It depends on the modem whether the application uses PPP or AT mode. We can summarize this particular design as follows:
5252

5353
- It uses an external IP stack, such as LWIP, or on-chip network stacks such as when the modem does not support PPP.
5454
- 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: 26 additions & 9 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,50 @@ 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/CTS connected on UART. If RTC/CTS are not connected on UART then define MDMRTS and MDMCTS to 'NC'.
5658

5759
### Cellular APIs
5860

5961
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.
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 application. Used to connect to operators 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+
CellularContext class can be easily instantiated with `CellularContext::get_default_instance()` which opens `CellularDevice` and via device opens `CellularContext`. Opening `CellularContext` via `get_default_instance` uses default values from mbed_app.json.
73+
Default values are not defined by default and must be overridden in mbed_app.json if they are needed:
74+
"target_overrides": {
75+
"*": {
76+
"nsapi.default-cellular-plmn": "\"12346\"",
77+
"nsapi.default-cellular-sim-pin": "\"1234\"",
78+
"nsapi.default-cellular-apn": "\"internet\"",
79+
"nsapi.default-cellular-username": 0,
80+
"nsapi.default-cellular-password": 0
81+
}
82+
}
83+
6984
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.
7085

7186
<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>
7287

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

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

8097
### UDP and TCP sockets
@@ -119,7 +136,7 @@ Consider the following points when selecting PPP or AT mode:
119136

120137
### Optimize for power consumption
121138

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).
139+
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).
123140

124141
#### PSM - Power Save Mode
125142

0 commit comments

Comments
 (0)