8000 GSM: cleanup power on sequence and add comments · arduino/ArduinoCore-mbed@8b06fb3 · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8b06fb3

Browse files
committed
GSM: cleanup power on sequence and add comments
1 parent e1b61e2 commit 8b06fb3

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

libraries/GSM/src/GSM.cpp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,26 @@ mbed::CellularDevice *mbed::CellularDevice::get_default_instance()
4646

4747
int arduino::GSMClass::begin(const char* pin, const char* apn, const char* username, const char* password, RadioAccessTechnologyType rat, uint32_t band, bool restart) {
4848

49+
/* Assume module is powered ON. Uncomment this line is you are using
50+
* Edge Control without Arduino_ConnectionHandler
51+
* #if defined (ARDUINO_EDGE_CONTROL)
52+
* pinMode(ON_MKR2, OUTPUT);
53+
* digitalWrite(ON_MKR2, HIGH);
54+
* #endif
55+
*/
56+
57+
/* Ensure module is not under reset */
58+
pinMode(MBED_CONF_GEMALTO_CINTERION_RST, OUTPUT);
59+
digitalWrite(MBED_CONF_GEMALTO_CINTERION_RST, LOW);
60+
61+
/* Reset module if needed */
4962
if (restart || isCmuxEnable()) {
5063
reset();
5164
}
5265

66+
/* Create rising edge on pin ON */
67+
on();
68+
5369
if (!_context) {
5470
_context = mbed::CellularContext::get_default_instance();
5571
}
@@ -59,9 +75,10 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern
5975
return 0;
6076
}
6177

62-
pinMode(MBED_CONF_GEMALTO_CINTERION_ON, INPUT_PULLDOWN);
63-
78+
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4)
79+
/* This is needed to wakeup module if hw flow control is enabled */
6480
static mbed::DigitalOut rts(MBED_CONF_GEMALTO_CINTERION_RTS, 0);
81+
#endif
6582

6683
_device = _context->get_device();
6784
_device->modem_debug_on(_at_debug);
@@ -159,10 +176,15 @@ NetworkInterface* arduino::GSMClass::getNetwork() {
159176
}
160177

161178
void arduino::GSMClass::reset() {
179+
/* Reset logic is inverted */
162180
pinMode(MBED_CONF_GEMALTO_CINTERION_RST, OUTPUT);
163181
digitalWrite(MBED_CONF_GEMALTO_CINTERION_RST, HIGH);
164182
delay(800);
165183
digitalWrite(MBED_CONF_GEMALTO_CINTERION_RST, LOW);
184+
}
185+
186+
void arduino::GSMClass::on() {
187+
/* Module needs a rising edge to power on */
166188
pinMode(MBED_CONF_GEMALTO_CINTERION_ON, OUTPUT);
167189
digitalWrite(MBED_CONF_GEMALTO_CINTERION_ON, LOW);
168190
delay(1);
@@ -171,6 +193,4 @@ void arduino::GSMClass::reset() {
171193
}
172194

173195

174-
175-
176196
arduino::GSMClass GSM;

libraries/GSM/src/GSM.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ class GSMClass : public MbedSocketClass {
155155
void onStatusChange(nsapi_event_t ev, intptr_t in);
156156

157157
void reset();
158+
void on();
158159
};
159160

160161
}

0 commit comments

Comments
 (0)
0