You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an example based on `mbed-os` cellular APIs that demonstrates a TCP or UDP echo transaction with a public echo server.
5
5
6
-
(Note: To see this example in a rendered form you can import into the Arm Mbed Online Compiler, please see [the documentation](https://os.mbed.com/docs/mbed-os/latest/apis/cellular-api.html#cellular-example-connection-establishment).)
6
+
(Note: To see this example in a rendered form you can import into the Arm Mbed Online Compiler, please see
This particular cellular application uses a cellular network and network-socket APIs that are part of [`mbed-os`](https://github.com/ARMmbed/mbed-os).
11
12
12
-
The program uses a [cellular modem driver](https://github.com/ARMmbed/mbed-os/tree/master/features/cellular/framework/API) using an external IP stack (LWIP) standard 3GPP AT 27.007 AT commands to setup the cellular modem and registers to the network.
13
+
The program uses a [cellular modem driver](https://github.com/ARMmbed/mbed-os/tree/master/connectivity/cellular/include/cellular/framework/API)
14
+
using an external IP stack standard 3GPP AT 27.007 AT commands to setup the cellular modem and registers to the network.
13
15
14
-
After registration, the driver opens a point-to-point protocol (PPP) pipe using LWIP with the cellular modem and connects to internet. This driver currently supports UART data connection type only between your cellular modem and MCU.
16
+
After registration, the driver opens a point-to-point protocol (PPP) pipe with the cellular modem and connects
17
+
to internet. This driver currently supports UART data connection type only between your cellular modem and MCU.
15
18
16
-
For more information on Arm Mbed OS cellular APIs and porting guide, please visit the [Mbed OS cellular API](https://os.mbed.com/docs/latest/reference/cellular.html) and [contributing documentation](https://os.mbed.com/docs/mbed-os/latest/contributing/index.html).
19
+
For more information on Arm Mbed OS cellular APIs and porting guide, please visit the
20
+
[Mbed OS cellular API](https://os.mbed.com/docs/mbed-os/latest/apis/cellular-networking.html) and
21
+
[Mbed OS cellular porting guide](https://os.mbed.com/docs/mbed-os/latest/porting/cellular-device-porting.html).
17
22
18
-
### Download the application
23
+
### Board support
24
+
25
+
Currently supported boards with onboard modem chips can be found under Mbed OS
Connect your mbed board to your computer over USB. It appears as removable storage.
72
+
73
+
When you run the `mbed compile` command above, mbed cli creates a .bin or a .hex file (depending on your target) in
74
+
```BUILD/<target-name>/<toolchain>``` under the example's directory. Drag and drop the file to the removable storage.
75
+
76
+
Alternatively you may launch compilation with `-f` flag to have mbed tools attempt to flash your board.
77
+
The tools will flash the binary to all targets that match the board specified by '-m' parameter.
29
78
30
79
### Change the network and SIM credentials
31
80
32
-
See the file `mbed_app.json` in the root directory of your application. This file contains all the user specific configurations your application needs. Provide the pin code for your SIM card, as well as any other cellular settings, or `null` if not used. For example:
81
+
See the file `mbed_app.json` in the root directory of your application. This file contains all the user specific
82
+
configurations your application needs. Provide the pin code for your SIM card, as well as any other cellular settings,
83
+
or `null` if not used. For example:
33
84
34
85
```json
35
86
"target_overrides": {
@@ -39,9 +90,8 @@ See the file `mbed_app.json` in the root directory of your application. This fil
39
90
40
91
### Selecting socket type (TCP, UDP or NONIP)
41
92
42
-
43
-
You can choose which socket type the application should use; however, please note that TCP is a more reliable transmission protocol. For example:
44
-
93
+
You can choose which socket type the application should use; however, please note that TCP is a more reliable
94
+
transmission protocol. For example:
45
95
46
96
```json
47
97
@@ -51,22 +101,24 @@ You can choose which socket type the application should use; however, please not
51
101
52
102
### Turning modem AT echo trace on
53
103
54
-
If you like details and wish to know about all the AT interactions between the modem and your driver, turn on the modem AT echo trace.
104
+
If you like details and wish to know about all the AT interactions between the modem and your driver, turn on the modem
105
+
AT echo trace:
55
106
56
107
```json
57
108
"cellular.debug-at": true
58
109
```
59
110
60
111
### Turning on the tracing and trace level
61
112
62
-
If you like to add more traces or follow the current ones you can turn traces on by changing `mbed-trace.enable` in mbed_app.json
113
+
If you like to add more traces or follow the current ones you can turn traces on by changing `mbed-trace.enable` in
114
+
mbed_app.json:
63
115
64
116
```"target_overrides": {
65
117
"*": {
66
118
"mbed-trace.enable": true,
67
119
```
68
120
69
-
After you have defined `mbed-trace.enable: true`, you can set trace levels by changing value in `trace-level`
121
+
After you have defined `mbed-trace.enable: true`, you can set trace levels by changing value in `trace-level`:
70
122
71
123
```"trace-level": {
72
124
"help": "Options are TRACE_LEVEL_ERROR,TRACE_LEVEL_WARN,TRACE_LEVEL_INFO,TRACE_LEVEL_DEBUG",
@@ -75,85 +127,61 @@ After you have defined `mbed-trace.enable: true`, you can set trace levels by ch
75
127
}
76
128
```
77
129
78
-
### Board support
130
+
## Running the example
79
131
80
-
The [cellular modem driver](https://github.com/ARMmbed/mbed-os/tree/master/features/cellular/framework/API) in this example uses PPP with an Mbed-supported external LwIP stack. It supports targets when modem exists on the Mbed Enabled target as opposed to plug-in modules (shields). For more details, please see our [Mbed OS cellular documentation](https://os.mbed.com/docs/mbed-os/latest/apis/cellular-api.html).
132
+
When example application is running information about activity is printed over the serial connection.
81
133
82
-
Currently supported boards with onboard modem chips can be found under Mbed OS [/targets folder](https://github.com/ARMmbed/mbed-os/tree/master/targets). You can find all cellular specific onboard modems by searching an overridden function ```CellularDevice::get_target_default_instance()```.
134
+
**Note:** The default serial baudrate has been set to 115200.
83
135
84
-
Currently supported modem drivers (for plug-in shields) can be found under cellular [/targets folder](https://github.com/ARMmbed/mbed-os/tree/master/features/cellular/framework/targets).
136
+
Please have a client open and connected to the board. You may use:
85
137
138
+
- [Tera Term](https://ttssh2.osdn.jp/index.html.en) for windows
86
139
87
-
For a cellular shield, you need to define which shield to use with `provide-default`, and also how the shield is connected to the Mbed OS board. For example, a generic AT/PPP modem would add from the `GENERIC_AT3GPP/mbed_lib.json` file to your `mbed_app.json`:
88
-
```
89
-
"target_overrides": {
90
-
"GENERIC_AT3GPP.provide-default": true,
91
-
"GENERIC_AT3GPP.tx": "<tx-pinmap>",
92
-
"GENERIC_AT3GPP.rx": "<rx-pinmap>"
93
-
}
94
-
```
140
+
- screen or minicom for Linux (example usage: `screen /dev/serial/<your board> 115200`)
95
141
96
-
## Compiling the application
142
+
- mbed tools has a terminal command `mbed term -b 115200`
97
143
98
-
The master branch is for daily development and it uses the latest mbed-os/master release.
99
-
100
-
To use older versions update Mbed OS release tag, for example:
101
-
102
-
```
103
-
mbed releases
104
-
* mbed-os-5.10.4
105
-
...
106
-
mbed update mbed-os-5.10.4
107
-
```
108
-
109
-
You may need to use `--clean` option to discard your local changes (use with caution).
110
-
111
-
Use Mbed CLI commands to generate a binary for the application. For example, in the case of GCC, use the following command:
Drag and drop the application binary from `BUILD/YOUR_TARGET_WITH_MODEM/GCC_ARM/mbed-os-example-cellular.bin` to your Mbed Enabled target hardware, which appears as a USB device on your host machine.
120
-
121
-
Attach a serial console emulator of your choice (for example, PuTTY, Minicom or screen) to your USB device. Set the baudrate to 115200 bit/s, and reset your board by pressing the reset button.
144
+
### Expected output
122
145
123
146
You should see an output similar to this:
124
147
125
148
```
126
149
mbed-os-example-cellular
127
-
Establishing connection ......
128
-
150
+
Establishing connection
129
151
Connection Established.
130
152
TCP: connected with echo.mbedcloudtesting.com server
131
153
TCP: Sent 4 Bytes to echo.mbedcloudtesting.com
132
154
Received from echo server 4 Bytes
133
-
134
-
135
155
Success. Exiting
136
156
```
137
157
138
-
## Troubleshooting
158
+
### Troubleshooting
139
159
140
-
* Make sure the fields `nsapi.default-cellular-sim-pin`, `nsapi.default-cellular-plmn`, `nsapi.default-cellular-apn`, `nsapi.default-cellular-username` and `nsapi.default-cellular-password` from the `mbed_app.json` file are filled in correctly. The correct values should appear in the user manual of the board if using eSIM or in the details of the SIM card if using normal SIM.
160
+
* Make sure the fields `nsapi.default-cellular-sim-pin`, `nsapi.default-cellular-plmn`, `nsapi.default-cellular-apn`,
161
+
`nsapi.default-cellular-username` and `nsapi.default-cellular-password` from the `mbed_app.json` file are filled in
162
+
correctly. The correct values should appear in the user manual of the board if using eSIM or in the details of the
163
+
SIM card if using normal SIM.
141
164
* Enable trace flag to have access to debug information `"mbed-trace.enable": true` and `"cellular.debug-at": true`.
142
-
* Error Message: Assertion failed: iface usually means that a default modem is not defined, e.g. `"GENERIC_AT3GPP.provide-default": true`
143
-
* If the modem does not respond to (AT) queries, check that UART pins (tx, rx, rts, cts) are connected and defined, e.g. `"GENERIC_AT3GPP.tx": "<tx-pinmap>"`, ...
144
-
* It is a common case that a modem seems to connect fine with just USB power, but actually it needs to have an external power supply for a data connection.
165
+
* Error Message: Assertion failed: iface usually means that a default modem is not defined, e.g.
166
+
`"GENERIC_AT3GPP.provide-default": true`
167
+
* If the modem does not respond to (AT) queries, check that UART pins (tx, rx, rts, cts) are connected and defined,
168
+
e.g. `"GENERIC_AT3GPP.tx": "<tx-pinmap>"`, ...
169
+
* It is a common case that a modem seems to connect fine with just USB power, but actually it needs to have an external
170
+
power supply for a data connection.
145
171
* Try both `TCP` and `UDP` socket types.
146
172
* Try both `"lwip.ppp-enabled": true` and `"lwip.ppp-enabled": false`.
147
173
* The modem may support only a fixed baud-rate, such as `"platform.default-serial-baud-rate": 9600`.
148
174
* The modem and network may only support IPv6 in which case `"lwip.ipv6-enabled": true` shall be defined.
149
175
* The SIM and modem must have compatible cellular technology (3G, 4G, NB-IoT, ...) supported and cellular network available.
150
176
* Enable CIoT optimization for NONIP socket `control-plane-opt: true`.
151
177
152
-
If you have problems to get started with debugging, you can review the [documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions on what could be wrong and how to fix it.
153
-
154
-
### License and contributions
178
+
If you have problems to get started with debugging, you can review the
179
+
[documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions on what could be wrong and how to fix it.
155
180
156
-
The software is provided under Apache-2.0 license. Contributions to this project are accepted under the same license. Please see [contributing.md](CONTRIBUTING.md) for more info.
181
+
## License and contributions
157
182
158
-
This project contains code from other projects. The original license text is included in those source files. They must comply with our license guide.
183
+
The software is provided under Apache-2.0 license. Contributions to this project are accepted under the same license.
184
+
Please see [contributing.md](CONTRIBUTING.md) for more info.
159
185
186
+
This project contains code from other projects. The original license text is included in those source files.
0 commit comments