Skip to content

Commit 216eb7a

Browse files
author
Ari Parkkila
committed
Cellular: Updated debug tracing
1 parent 4ab2352 commit 216eb7a

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,10 @@ You can choose which socket type the application should use; however, please not
6161

6262
### Turning modem AT echo trace on
6363

64-
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. Set the `modem_trace` field value to be true.
64+
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.
6565

6666
```json
67-
"modem_trace": {
68-
"help": "Turns AT command trace on/off from the cellular modem, defaults to off",
69-
"value": true
70-
},
67+
"cellular.debug-at": true
7168
```
7269

7370
### Turning on the tracing and trace level
@@ -76,8 +73,8 @@ If you like to add more traces or follow the current ones you can turn traces on
7673

7774
```"target_overrides": {
7875
"*": {
79-
"target.features_add": ["LWIP", "COMMON_PAL"],
80-
"mbed-trace.enable": false,
76+
"target.features_add": ["LWIP"],
77+
"mbed-trace.enable": true,
8178
```
8279

8380
After you have defined `mbed-trace.enable: true`, you can set trace levels by changing value in `trace-level`
@@ -126,4 +123,12 @@ Success. Exiting
126123

127124
## Troubleshooting
128125

129-
If you have problems, 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.
126+
* Make sure the fields `sim-pin-code`, `apn`, `username` and `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.
127+
* Enable trace flag to have access to debug information `"mbed-trace.enable": true`.
128+
* Try both `TCP` and `UDP` socket types.
129+
* Try both `"lwip.ppp-enabled": true` and `"lwip.ppp-enabled": false`.
130+
* The modem may support only a fixed baud-rate, such as `"platform.default-serial-baud-rate": 9600`.
131+
* The modem and network may only support IPv6 in which case `"lwip.ipv6-enabled": true` shall be defined.
132+
* The SIM and modem must have compatible cellular technology (3G, 4G, NB-IoT, ...) supported and cellular network available.
133+
134+
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.

main.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,16 @@ static void trace_open()
8080

8181
mbed_trace_mutex_wait_function_set(trace_wait);
8282
mbed_trace_mutex_release_function_set(trace_release);
83+
84+
mbed_cellular_trace::mutex_wait_function_set(trace_wait);
85+
mbed_cellular_trace::mutex_release_function_set(trace_release);
8386
}
8487

8588
static void trace_close()
8689
{
90+
mbed_cellular_trace::mutex_wait_function_set(NULL);
91+
mbed_cellular_trace::mutex_release_function_set(NULL);
92+
8793
mbed_trace_free();
8894
}
8995
#endif // #if MBED_CONF_MBED_TRACE_ENABLE
@@ -228,9 +234,6 @@ int main()
228234
/* Set network credentials here, e.g., APN */
229235
iface.set_credentials(MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD);
230236

231-
/* Set the modem debug on/off */
232-
iface.modem_debug_on(MBED_CONF_APP_MODEM_TRACE);
233-
234237
nsapi_error_t retcode = NSAPI_ERROR_NO_CONNECTION;
235238

236239
/* Attempt to connect to a cellular network */

mbed_app.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"target_overrides": {
3131
"*": {
32-
"target.features_add": ["LWIP", "COMMON_PAL"],
32+
"target.features_add": ["LWIP"],
3333
"mbed-trace.enable": false,
3434
"lwip.ipv4-enabled": true,
3535
"lwip.ethernet-enabled": false,
@@ -38,7 +38,8 @@
3838
"platform.stdio-convert-newlines": true,
3939
"platform.stdio-baud-rate": 115200,
4040
"platform.default-serial-baud-rate": 115200,
41-
"platform.stdio-buffered-serial": true
41+
"platform.stdio-buffered-serial": true,
42+
"cellular.debug-at": false
4243
}
4344
}
4445
}

0 commit comments

Comments
 (0)