Home › Forums › Mayfly Data Logger › XBee and Hologram LTE: issues connecting to internet › Reply To: XBee and Hologram LTE: issues connecting to internet
2020-12-23 at 3:09 AM
#14967
Sigh, so I thought we had this but I’m getting the same result. My code is below, as well as the serial output.
Any thoughts?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
#define TINY_GSM_MODEM_XBEE #define TINY_GSM_RX_BUFFER 64 #define TINY_GSM_YIELD_MS 2 #define TINY_GSM_DEBUG Serial #include <Arduino.h> #include <StreamDebugger.h> #include <TinyGsmClient.h> StreamDebugger debugger(Serial1, Serial); TinyGsm gsmModem(debugger); const char* apn = "m2m"; void setup() { // Set the reset pin HIGH to ensure the Bee does not continually reset pinMode(20, OUTPUT); digitalWrite(20, HIGH); // Set the sleep_rq pin LOW to wake the Bee pinMode(23, OUTPUT); digitalWrite(23, LOW); // Set the input pin mode pinMode(19, INPUT); // Set console baud rate Serial.begin(115200); delay(10); // Set XBee module baud rate Serial1.begin(9600); // Wait for warm-up, probably overkill delay(6000); } void loop() { /** First run the TinyGSM init() function for the XBee. */ DBG(F("Initializing the XBee...")); gsmModem.init(); /** Then enter command mode to set pin outputs. */ DBG(F("Putting XBee into command mode...")); if (gsmModem.commandMode()) { DBG(F("Setting I/O Pins...")); /** Enable pin sleep functionality on <code>DIO9</code>. * NOTE: Only the <code>DTR_N/SLEEP_RQ/DIO8</code> pin (9 on the bee socket) can be * used for this pin sleep/wake. */ gsmModem.sendAT(GF("D8"), 1); gsmModem.waitResponse(); /** Enable status indication on <code>DIO9</code> - it will be HIGH when the XBee * is awake. * NOTE: Only the <code>ON/SLEEP_N/DIO9</code> pin (13 on the bee socket) can be * used for direct status indication. */ gsmModem.sendAT(GF("D9"), 1); gsmModem.waitResponse(); /** Enable CTS on <code>DIO7</code> - it will be <code>LOW</code> when it is clear to send * data to the XBee. This can be used as proxy for status indication if * that pin is not readable. * NOTE: Only the <code>CTS_N/DIO7</code> pin (12 on the bee socket) can be used * for CTS. */ gsmModem.sendAT(GF("D7"), 1); gsmModem.waitResponse(); /** Enable association indication on <code>DIO5</code> - this is should be directly * attached to an LED if possible. * - Solid light indicates no connection * - Single blink indicates connection * - double blink indicates connection but failed TCP link on last * attempt * * NOTE: Only the <code>Associate/DIO5</code> pin (15 on the bee socket) can be * used for this function. */ gsmModem.sendAT(GF("D5"), 1); gsmModem.waitResponse(); /** Enable RSSI PWM output on <code>DIO10</code> - this should be directly attached * to an LED if possible. A higher PWM duty cycle (and thus brighter * LED) indicates better signal quality. * NOTE: Only the <code>DIO10/PWM0</code> pin (6 on the bee socket) can be used for * this function. */ gsmModem.sendAT(GF("P0"), 1); gsmModem.waitResponse(); /** Enable pin sleep on the XBee. */ DBG(F("Setting Sleep Options...")); gsmModem.sendAT(GF("SM"), 1); gsmModem.waitResponse(); /** Disassociate from the network for the lowest power deep sleep. */ gsmModem.sendAT(GF("SO"), 0); gsmModem.waitResponse(); DBG(F("Setting Other Options...")); /** Disable remote manager, USB Direct, and LTE PSM * NOTE: LTE-M's PSM (Power Save Mode) sounds good, but there's no easy * way on the LTE-M Bee to wake the cell chip itself from PSM, so we'll * use the Digi pin sleep instead. */ gsmModem.sendAT(GF("DO"), 0); gsmModem.waitResponse(); /** Ask data to be "packetized" and sent out with every new line (0x0A) * character. */ gsmModem.sendAT(GF("TD0A")); gsmModem.waitResponse(); /* Make sure USB direct is NOT enabled on the XBee3 units. */ gsmModem.sendAT(GF("P1"), 0); gsmModem.waitResponse(); /** Set the socket timeout to 10s (this is default). */ gsmModem.sendAT(GF("TM"), 64); gsmModem.waitResponse(); DBG(F("Setting Cellular Carrier Options...")); // Carrier Profile - 0 = Automatic selection // - 1 = No profile/SIM ICCID selected // - 2 = AT&T // - 3 = Verizon // NOTE: To select T-Mobile, you must enter bypass mode! gsmModem.sendAT(GF("CP"), 1); //change to 1 for Spark gsmModem.waitResponse(); // Cellular network technology - 0 = LTE-M with NB-IoT fallback // - 1 = NB-IoT with LTE-M fallback // - 2 = LTE-M only // - 3 = NB-IoT only gsmModem.sendAT(GF("N#"), 0); gsmModem.waitResponse(); //set the band mask for spark DBG(F("Setting the Band Mask...")); gsmModem.sendAT(GF("BM134217732")); gsmModem.waitResponse(); DBG(F("Setting the APN...")); /** Save the network connection parameters. */ gsmModem.gprsConnect(apn); DBG(F("Ensuring XBee is in transparent mode...")); /* Make sure we're really in transparent mode. */ gsmModem.sendAT(GF("AP0")); gsmModem.waitResponse(); /** Write all changes to flash and apply them. */ DBG(F("Applying changes...")); gsmModem.writeChanges(); /** Finally, exit command mode. */ gsmModem.exitCommand(); /** Force restart the modem to make sure all settings take. */ DBG(F("Restarting XBee...")); gsmModem.restart(); } else { // wait a bit delay(30000L); // try again return; } // Scan for networks - this is probably really slow gsmModem.sendAT(GF("AS")); gsmModem.waitResponse(180000L, GF("S"), GF("ERROR")); while (Serial1.available()) { Serial.println(Serial1.readStringUntil('\r')); } // Wait forever for a connection DBG(F("Waiting for network registration")); while (!gsmModem.isNetworkConnected()) { int csq = gsmModem.getSignalQuality(); DBG("Signal quality:", csq); delay(250); } // Scan for networks - this is probably really slow gsmModem.sendAT(GF("AS")); gsmModem.waitResponse(180000L, GF("S"), GF("ERROR")); while (Serial1.available()) { Serial.println(Serial1.readStringUntil('\r')); } // Print some stuff after connected String ccid = gsmModem.getSimCCID(); DBG("CCID:", ccid); String imei = gsmModem.getIMEI(); DBG("IMEI:", imei); String imsi = gsmModem.getIMSI(); DBG("IMSI:", imsi); String cop = gsmModem.getOperator(); DBG("Operator:", cop); IPAddress local = gsmModem.localIP(); DBG("Local IP:", local); // Shut down gsmModem.poweroff(); DBG("Powering down."); // And do nothing forever more. while (1) {} } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
[6008] Initializing the XBee... [6010] ### TinyGSM Version: 0.10.6 [6010] ### TinyGSM Compiled Module: TinyGsmClientXBee [7272] ### Modem: Digi XBee3 Cellular LTE-M [7288] Putting XBee into command mode... [7522] Setting I/O Pins... [7610] Setting Sleep Options... [7645] Setting Other Options... [7716] Setting Cellular Carrier Options... [7751] Setting the Band Mask... [7778] Setting the APN... [7876] Ensuring XBee is in transparent mode... [7895] Applying changes... [7972] Restarting XBee... +++[8742] ### NO RESPONSE FROM MODEM! [9320] ### TinyGSM Version: 0.10.6 [9320] ### TinyGSM Compiled Module: TinyGsmClientXBee [9678] ### Modem: Digi XBee3 Cellular LTE-M ATAS [189704] Waiting for network registration [190222] Signal quality: 0 [190990] Signal quality: 0 [191758] Signal quality: 0 [192526] Signal quality: 0 [193294] Signal quality: 0 ..... for two hours... |