Skip to content

[5.10 OOB] Cellular porting fixes #712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/reference/contributing/connectivity/CellularInterface.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ typedef enum {

### Adding a new cellular target

You need to specify in [CellularTargets.h](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_cellular_targets_8h_source.html), which `<manufacturer-module>` is mounted on your board.
You need to specify in [CellularTargets.h](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_cellular_targets_8h_source.html) the `<manufacturer-module>` that is mounted on your board.

```target

Expand All @@ -71,20 +71,20 @@ You can browse the existing `manufacturer-modules` under `features/cellular/fram

### Adding a new cellular module

Cellular module adaptations are very similar to each other and due to they only need to implement deviation from the default implementation, you can most probably reuse some existing adaptation.
You can probably reuse an existing adaptation because most cellular modules are similar to one another.

You need to create a new folder as _MANUFACTURER/MODULE/_ for your new cellular module in `features/cellular/framework/targets/`. A device class inheriting [AT_CellularDevice](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_a_t___cellular_device_8h_source.html) is a minimum, and you may need to extend other cellular APIs as well if the default implementation is not sufficient for your cellular module.

### Socket adaptation

You can implement socket API in two ways:
You can implement the socket API in two ways:

- Use the IP stack on the cellular module (AT mode).
- Use the LWIP stack on Mbed OS (PPP mode).

If your cellular module has an IP stack, you need to implement AT commands to connect to a network and to control network sockets. If the modem supports PPP mode, you can use LWIP stack to handle sockets and IP connectivity for your modem after connected to a network. A modem can support the both AT and PPP modes, but an application developer need to select at compile time whether to use AT mode or PPP mode in the application's `mbed_app.json` configuration file using `lwip.ppp-enabled` flag.
If your cellular module has an IP stack, you need to implement the AT commands to connect to a network and to control network sockets. If the modem supports PPP mode, you can use the LWIP stack to handle sockets and IP connectivity for your modem after it connects to a network. A modem can support both the AT and PPP modes, but an application developer needs to select at compile time which mode should be used. This selection is made in the application's `mbed_app.json` configuration file using the `lwip.ppp-enabled` flag.

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

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](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/_easy_cellular_connection_8h_source.html), which in turn instantiates [CellularConnectionFSM class](https://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](https://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](https://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()](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/netsocket_2nsapi__ppp_8h_source.html) to start the data call through the PPP pipe using LWIP sockets.

Expand All @@ -107,4 +107,4 @@ To run the tests:
mbed test -n "mbed-os-features-cellular-tests-*" -m TARGET -t TOOLCHAIN --app-config YOURCONFIG.json
```

For more information on the `mbed-greentea` test suite, please visit [its documentation](/docs/development/tools/greentea.html).
For more information on the `mbed-greentea` test suite, please visit [its documentation](/docs/development/tools/greentea-testing-applications.html).