Skip to content

Commit 00d9114

Browse files
committed
STMOD_CELLULAR: improve debug print
1 parent a8ee2d8 commit 00d9114

File tree

2 files changed

+64
-36
lines changed

2 files changed

+64
-36
lines changed

components/cellular/COMPONENT_STMOD_CELLULAR/README.md

Lines changed: 53 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,78 @@ and [p-l496g-cell02](https://www.st.com/en/evaluation-tools/p-l496g-cell02.html)
1111

1212
The STMOD+ Connector specification can be found [here](https://www.st.com/content/ccc/resource/technical/document/technical_note/group0/04/7f/90/c1/ad/54/46/1f/DM00323609/files/DM00323609.pdf/jcr:content/translations/en.DM00323609.pdf).
1313

14+
## Debug print
15+
16+
mbed_trace feature is used: https://github.com/ARMmbed/mbed-os/blob/master/features/frameworks/mbed-trace/README.md
17+
18+
Enable it in your mbed_app.json file:
19+
20+
````
21+
{
22+
"target_overrides": {
23+
"*": {
24+
"mbed-trace.enable": 1
25+
}
26+
}
27+
}
28+
````
29+
30+
Look for "STMOD" group name:
31+
````
32+
[DBG ][STMOD]: STMOD_CELLULAR default instance
33+
[INFO][STMOD]: STModCellular creation
34+
[DBG ][STMOD]: STMOD cellular modem power ON
35+
[INFO][STMOD]: Booting BG96
36+
[INFO][STMOD]: Modem ready to receive AT commands
37+
[INFO][STMOD]: Enable flow control
38+
[DBG ][STMOD]: Flow control turned ON
39+
````
40+
41+
1442
## Cellular tests in mbed-os
1543

16-
- features-cellular-tests-api-cellular_device
17-
- features-cellular-tests-api-cellular_information
18-
- features-cellular-tests-api-cellular_network
19-
- features-cellular-tests-api-cellular_sms
20-
- features-cellular-tests-socket-udp
44+
Since mbed-os-5.14.1, cellular tests have been replaced with generic mbed-os netsocket and network interface tests.
45+
46+
https://github.com/ARMmbed/mbed-os/blob/master/TESTS/netsocket/README.md
2147

22-
Here is the used mbed_app.json:
48+
Here is an example of needed mbed_app.json:
2349

2450
````
2551
{
2652
"config": {
27-
"cellular-sim-pin" : {
28-
"help": "PIN code",
29-
"value": "\"1234\""
53+
"echo-server-discard-port": {
54+
"help": "Discard port of echo server",
55+
"value": "9
3056
},
31-
"apn": {
32-
"help": "The APN string to use for this SIM/network, set to 0 if none",
33-
"value": "\"APN\""
57+
"echo-server-discard-port-tls": {
58+
"help": "Discard port of echo server",
59+
"value": "2009"
3460
},
35-
"username": {
36-
"help": "The user name string to use for this APN, set to zero if none",
37-
"value": 0
61+
"echo-server-port": {
62+
"help": "Port of echo server",
63+
"value": "7"
3864
},
39-
"password": {
40-
"help": "The password string to use for this APN, set to 0 if none",
41-
"value": 0
42-
}
43-
},
65+
"echo-server-port-tls": {
66+
"help": "Echo port of echo server",
67+
"value": "2007"
68+
},
69+
},
4470
"target_overrides": {
4571
"DISCO_L496AG": {
46-
"target.components_add": ["STMOD_CELLULAR"],
47-
"stmod_cellular.provide-default": "true"
72+
"target.components_add": [
73+
"STMOD_CELLULAR"
74+
],
75+
"stmod_cellular.provide-default": "true",
76+
"nsapi.default-cellular-apn": "\"APN\"",
77+
"target.network-default-interface-type": "CELLULAR"
4878
}
4979
}
5080
}
5181
````
5282

5383

5484
````
55-
$ mbed test -t ARM -m DISCO_L496AG -v -n features-cellular-*
85+
$ mbed test -t ARM -m DISCO_L496AG -v -n tests-net*
5686
````
5787

5888
## Cellular mbed-os example

components/cellular/COMPONENT_STMOD_CELLULAR/STModCellular.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "rtos/ThisThread.h"
2020
#include "mbed_trace.h"
2121

22-
#define TRACE_GROUP "CELL"
22+
#define TRACE_GROUP "STMOD"
2323

2424
using namespace mbed;
2525

@@ -33,7 +33,7 @@ STModCellular::STModCellular(FileHandle *fh) : STMOD_CELLULAR_MODEM(fh),
3333
m_sim_clk(MBED_CONF_STMOD_CELLULAR_SIM_CLK),
3434
m_sim_data(MBED_CONF_STMOD_CELLULAR_SIM_DATA)
3535
{
36-
tr_debug("STModCellular creation\r\n");
36+
tr_info("STModCellular creation");
3737

3838
// start with modem disabled
3939
m_powerkey.write(0);
@@ -54,10 +54,10 @@ STModCellular::~STModCellular()
5454

5555
nsapi_error_t STModCellular::soft_power_on()
5656
{
57-
tr_debug("STMOD cellular modem power ON\r\n");
57+
tr_debug("STMOD cellular modem power ON");
5858

5959
#if (MBED_CONF_STMOD_CELLULAR_TYPE == STMOD_UG96)
60-
tr_debug("Booting UG96\r\n");
60+
tr_info("Booting UG96");
6161
m_reset.write(1);
6262
rtos::ThisThread::sleep_for(200);
6363
m_reset.write(0);
@@ -68,9 +68,8 @@ nsapi_error_t STModCellular::soft_power_on()
6868
/* Because modem status is not available on STMOD+ connector,
6969
* let's wait for Modem complete boot */
7070
rtos::ThisThread::sleep_for(2300);
71-
#endif
72-
#if (MBED_CONF_STMOD_CELLULAR_TYPE == STMOD_BG96)
73-
tr_debug("Booting BG96\r\n");
71+
#elif (MBED_CONF_STMOD_CELLULAR_TYPE == STMOD_BG96)
72+
tr_info("Booting BG96");
7473
m_powerkey.write(1);
7574
m_reset.write(1);
7675
rtos::ThisThread::sleep_for(150);
@@ -107,10 +106,10 @@ nsapi_error_t STModCellular::soft_power_on()
107106
_at->restore_at_timeout();
108107
_at->unlock();
109108

110-
tr_debug("Modem %sready to receive AT commands\r\n", rdy ? "" : "NOT ");
109+
tr_info("Modem %sready to receive AT commands", rdy ? "" : "NOT ");
111110

112111
if ((MBED_CONF_STMOD_CELLULAR_CTS != NC) && (MBED_CONF_STMOD_CELLULAR_RTS != NC)) {
113-
tr_debug("Enable flow control\r\n");
112+
tr_info("Enable flow control");
114113

115114
pin_mode(MBED_CONF_STMOD_CELLULAR_CTS, PullDown);
116115

@@ -127,9 +126,9 @@ nsapi_error_t STModCellular::soft_power_on()
127126
_at->unlock();
128127

129128
if (err == NSAPI_ERROR_OK) {
130-
tr_debug("Flow control turned ON\r\n");
129+
tr_debug("Flow control turned ON");
131130
} else {
132-
tr_error("Failed to enable hw flow control\r\n");
131+
tr_error("Failed to enable hw flow control");
133132
}
134133
}
135134

@@ -160,11 +159,10 @@ nsapi_error_t STModCellular::soft_power_off()
160159
#include "UARTSerial.h"
161160
CellularDevice *CellularDevice::get_default_instance()
162161
{
163-
tr_debug("MODEM default instance\r\n");
162+
tr_debug("STMOD_CELLULAR default instance");
164163

165164
static UARTSerial serial(MBED_CONF_STMOD_CELLULAR_TX, MBED_CONF_STMOD_CELLULAR_RX, MBED_CONF_STMOD_CELLULAR_BAUDRATE);
166165
if ((MBED_CONF_STMOD_CELLULAR_CTS != NC) && (MBED_CONF_STMOD_CELLULAR_RTS != NC)) {
167-
tr_debug("STMOD_CELLULAR flow control: RTS %d CTS %d\r\n", MBED_CONF_STMOD_CELLULAR_RTS, MBED_CONF_STMOD_CELLULAR_CTS);
168166
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_STMOD_CELLULAR_RTS, MBED_CONF_STMOD_CELLULAR_CTS);
169167
}
170168
static STModCellular device(&serial);

0 commit comments

Comments
 (0)