AT command firmware for MultiTech Dot devices.

Fork of mDot_AT_firmware by MultiTech

Dot Library Not Included!

Because these example programs can be used for both mDot and xDot devices, the LoRa stack is not included. The libmDot library should be imported if building for mDot devices. The libxDot library should be imported if building for xDot devices. The AT firmware was last tested with mbed-os-5.4.7. Using a version past mbed-os-5.4.7 will cause the build to fail. The library used with the AT firmware has to match the mbed-os version.

Dot Library Version 3 Updates

Dot Library versions 3.x.x require a channel plan to be injected into the stack. The Dot-Examples and Dot-AT-Firmware do this by defining a macro called "CHANNEL_PLAN" that controls the channel plan that will be used in the examples. Available channel plans will be in the Dot Library repository in the plans folder.

Revision 20 and earlier of Dot-Examples and revision 15 and earlier of Dot-AT-Firmware should be used with Dot Library versions prior to 3.0.0.

Fota Library

Th Fota Library must be added to compile for mDot 3.1.0 with Fota support. Latest dev libraries and 3.2.0 release will include Fota with libmDot/libxDot.

AT Firmware Description

This AT Firmware is what ships on mDot and xDot devices. It provides an AT command interface for using the mDot or xDot for LoRa communication.

AT command documentation can be found on Multitech.com.

The firmware changelog can be found here. The library changelog can be found here.

Dot Libraries

Dot Library Limitations

The commit messages in libmDot-mbed5 and libmDot-dev-mbed5 specify the version of the Dot library the commit contains and the version of mbed-os it was compiled against. We recommend building your application with the version of mbed-os specified in the commit message of the version of the Dot library you're using. This will ensure that you don't run into any runtime issues caused by differences in the mbed-os versions.

Stable and development libraries are available for both mDot and xDot platforms. The library chosen must match the target platform. Compiling for the mDot platform with the xDot library or vice versa will not succeed.

mDot Library

Development library for mDot.

libmDot-dev

Stable library for mDot.

libmDot

xDot Library

Development library for xDot.

libxDot-dev

Stable library for xDot.

libxDot

Committer:
Jason Reiss
Date:
Wed Dec 06 13:33:52 2023 -0600
Revision:
42:23e2df6714f4
Parent:
34:3b696c2b1e4b
TestMode: reset appnonce to 0 on reset to accomodate LCTT 3.12.0 and earlier. If the test suite changes to test AppNonce loaded from NVM this will fail tests.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Mike Fiore 4:666017851052 1 #include "CmdWakePin.h"
Mike Fiore 4:666017851052 2
Jason Reiss 28:c222ca8383f4 3 CmdWakePin::CmdWakePin() :
Jason Reiss 28:c222ca8383f4 4 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 34:3b696c2b1e4b 5 Command("Wake Pin", "AT+WP", "Wakeup DIO pin of sleep mode (1-8) (default: DI8, 1:DIN), deep-sleep uses DIO7", "(1-8),(0:NOPULL,1:PULLUP,2:PULLDOWN),(0:ANY,1:RISE,2:FALL)")
Mike Fiore 14:f9a77400b622 6 #else
Jason Reiss 28:c222ca8383f4 7 Command("AT+WP")
Jason Reiss 28:c222ca8383f4 8 #endif
Jason Reiss 28:c222ca8383f4 9 {
Mike Fiore 4:666017851052 10 _queryable = true;
Mike Fiore 4:666017851052 11 }
Mike Fiore 4:666017851052 12
jenkins@jenkinsdm1 18:63f098f042b2 13 uint32_t CmdWakePin::action(const std::vector<std::string>& args) {
Mike Fiore 4:666017851052 14 if (args.size() == 1) {
Jason Reiss 34:3b696c2b1e4b 15 static char modes[][10] = {
Jason Reiss 34:3b696c2b1e4b 16 "NOPULL", "PULLUP", "PULLDOWN", "OTHER"
Jason Reiss 34:3b696c2b1e4b 17 };
Jason Reiss 34:3b696c2b1e4b 18 static char triggers[][5] = {
Jason Reiss 34:3b696c2b1e4b 19 "ANY", "RISE", "FALL", "?"
Jason Reiss 34:3b696c2b1e4b 20 };
Jason Reiss 34:3b696c2b1e4b 21
Jason Reiss 34:3b696c2b1e4b 22 int mode;
Jason Reiss 34:3b696c2b1e4b 23 PinMode pm = CommandTerminal::Dot()->getWakePinMode();
Jason Reiss 34:3b696c2b1e4b 24 switch (pm) {
Jason Reiss 34:3b696c2b1e4b 25 case PullNone:
Jason Reiss 34:3b696c2b1e4b 26 mode = 0;
Jason Reiss 34:3b696c2b1e4b 27 break;
Jason Reiss 34:3b696c2b1e4b 28 case PullUp:
Jason Reiss 34:3b696c2b1e4b 29 mode = 1;
Jason Reiss 34:3b696c2b1e4b 30 break;
Jason Reiss 34:3b696c2b1e4b 31 case PullDown:
Jason Reiss 34:3b696c2b1e4b 32 mode = 2;
Jason Reiss 34:3b696c2b1e4b 33 break;
Jason Reiss 34:3b696c2b1e4b 34 default:
Jason Reiss 34:3b696c2b1e4b 35 mode = 3;
Jason Reiss 34:3b696c2b1e4b 36 break;
Jason Reiss 34:3b696c2b1e4b 37 }
Jason Reiss 34:3b696c2b1e4b 38
Jason Reiss 34:3b696c2b1e4b 39 int trigger = CommandTerminal::Dot()->getWakePinTrigger();
Jason Reiss 34:3b696c2b1e4b 40 if (trigger > 2) {
Jason Reiss 34:3b696c2b1e4b 41 trigger = 3;
Jason Reiss 34:3b696c2b1e4b 42 }
Jason Reiss 34:3b696c2b1e4b 43
Jason Reiss 34:3b696c2b1e4b 44 CommandTerminal::Serial()->writef("%s,%s,%s\r\n",
Jason Reiss 34:3b696c2b1e4b 45 mDot::pinName2Str(CommandTerminal::Dot()->getWakePin()).c_str(),
Jason Reiss 34:3b696c2b1e4b 46 modes[mode],
Jason Reiss 34:3b696c2b1e4b 47 triggers[trigger]);
Jason Reiss 34:3b696c2b1e4b 48
Jason Reiss 34:3b696c2b1e4b 49 } else if (args.size() >= 2) {
Mike Fiore 9:ff62b20f7000 50 int pin;
Mike Fiore 9:ff62b20f7000 51 sscanf(args[1].c_str(), "%d", &pin);
Mike Fiore 4:666017851052 52
Mike Fiore 14:f9a77400b622 53 CommandTerminal::Dot()->setWakePin(mDot::pinNum2Name(pin));
Jason Reiss 34:3b696c2b1e4b 54
Jason Reiss 34:3b696c2b1e4b 55 if (args.size() > 2) {
Jason Reiss 34:3b696c2b1e4b 56 int mode;
Jason Reiss 34:3b696c2b1e4b 57 sscanf(args[2].c_str(), "%d", &mode);
Jason Reiss 34:3b696c2b1e4b 58 PinMode pm;
Jason Reiss 34:3b696c2b1e4b 59 switch (mode) {
Jason Reiss 34:3b696c2b1e4b 60 case 0:
Jason Reiss 34:3b696c2b1e4b 61 pm = PullNone;
Jason Reiss 34:3b696c2b1e4b 62 break;
Jason Reiss 34:3b696c2b1e4b 63 case 1:
Jason Reiss 34:3b696c2b1e4b 64 pm = PullUp;
Jason Reiss 34:3b696c2b1e4b 65 break;
Jason Reiss 34:3b696c2b1e4b 66 case 2:
Jason Reiss 34:3b696c2b1e4b 67 pm = PullDown;
Jason Reiss 34:3b696c2b1e4b 68 break;
Jason Reiss 34:3b696c2b1e4b 69 default:
Jason Reiss 34:3b696c2b1e4b 70 pm = PullDefault;
Jason Reiss 34:3b696c2b1e4b 71 break;
Jason Reiss 34:3b696c2b1e4b 72 }
Jason Reiss 34:3b696c2b1e4b 73 CommandTerminal::Dot()->setWakePinMode(pm);
Jason Reiss 34:3b696c2b1e4b 74 }
Jason Reiss 34:3b696c2b1e4b 75
Jason Reiss 34:3b696c2b1e4b 76 if (args.size() > 3) {
Jason Reiss 34:3b696c2b1e4b 77 int trigger;
Jason Reiss 34:3b696c2b1e4b 78 sscanf(args[3].c_str(), "%d", &trigger);
Jason Reiss 34:3b696c2b1e4b 79 CommandTerminal::Dot()->setWakePinTrigger(trigger);
Jason Reiss 34:3b696c2b1e4b 80 }
Mike Fiore 4:666017851052 81 }
Mike Fiore 4:666017851052 82
Mike Fiore 4:666017851052 83 return 0;
Mike Fiore 4:666017851052 84 }
Mike Fiore 4:666017851052 85
jenkins@jenkinsdm1 18:63f098f042b2 86 bool CmdWakePin::verify(const std::vector<std::string>& args) {
Mike Fiore 4:666017851052 87 if (args.size() == 1)
Mike Fiore 4:666017851052 88 return true;
Mike Fiore 4:666017851052 89
Jason Reiss 34:3b696c2b1e4b 90 if (args.size() >= 2) {
Mike Fiore 9:ff62b20f7000 91 int pin;
Mike Fiore 9:ff62b20f7000 92 if (sscanf(args[1].c_str(), "%d", &pin) != 1) {
Jason Reiss 28:c222ca8383f4 93 #if MTS_CMD_TERM_VERBOSE
Mike Fiore 14:f9a77400b622 94 CommandTerminal::setErrorMessage("Invalid argument");
Jason Reiss 28:c222ca8383f4 95 #endif
Mike Fiore 4:666017851052 96 return false;
Mike Fiore 4:666017851052 97 }
Mike Fiore 4:666017851052 98
Mike Fiore 14:f9a77400b622 99 #if defined(TARGET_MTS_MDOT_F411RE)
Mike Fiore 9:ff62b20f7000 100 if (pin < 1 || pin > 8) {
Jason Reiss 28:c222ca8383f4 101 #if MTS_CMD_TERM_VERBOSE
Mike Fiore 14:f9a77400b622 102 CommandTerminal::setErrorMessage("Invalid pin, expects (1-8)");
Jason Reiss 28:c222ca8383f4 103 #endif
Mike Fiore 14:f9a77400b622 104 #else
Mike Fiore 14:f9a77400b622 105 if (pin < 1 || pin > 6) {
Jason Reiss 28:c222ca8383f4 106 #if MTS_CMD_TERM_VERBOSE
Mike Fiore 14:f9a77400b622 107 CommandTerminal::setErrorMessage("Invalid pin, expects (1-6)");
Jason Reiss 28:c222ca8383f4 108 #endif
Mike Fiore 14:f9a77400b622 109 #endif /* TARGET_MTS_MDOT_F411RE */
Mike Fiore 4:666017851052 110 return false;
Mike Fiore 4:666017851052 111 }
Mike Fiore 4:666017851052 112
Jason Reiss 34:3b696c2b1e4b 113 if (args.size() > 2) {
Jason Reiss 34:3b696c2b1e4b 114 int mode;
Jason Reiss 34:3b696c2b1e4b 115 if (sscanf(args[2].c_str(), "%d", &mode) != 1) {
Jason Reiss 34:3b696c2b1e4b 116 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 34:3b696c2b1e4b 117 CommandTerminal::setErrorMessage("Invalid argument");
Jason Reiss 34:3b696c2b1e4b 118 #endif
Jason Reiss 34:3b696c2b1e4b 119 return false;
Jason Reiss 34:3b696c2b1e4b 120 }
Jason Reiss 34:3b696c2b1e4b 121
Jason Reiss 34:3b696c2b1e4b 122 if (mode < 0 || mode > 2) {
Jason Reiss 34:3b696c2b1e4b 123 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 34:3b696c2b1e4b 124 CommandTerminal::setErrorMessage("Invalid pin mode, expects (0-2)");
Jason Reiss 34:3b696c2b1e4b 125 #endif
Jason Reiss 34:3b696c2b1e4b 126 return false;
Jason Reiss 34:3b696c2b1e4b 127 }
Jason Reiss 34:3b696c2b1e4b 128 }
Jason Reiss 34:3b696c2b1e4b 129
Jason Reiss 34:3b696c2b1e4b 130 if (args.size() > 3) {
Jason Reiss 34:3b696c2b1e4b 131 int trigger;
Jason Reiss 34:3b696c2b1e4b 132 if (sscanf(args[3].c_str(), "%d", &trigger) != 1) {
Jason Reiss 34:3b696c2b1e4b 133 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 34:3b696c2b1e4b 134 CommandTerminal::setErrorMessage("Invalid argument");
Jason Reiss 34:3b696c2b1e4b 135 #endif
Jason Reiss 34:3b696c2b1e4b 136 return false;
Jason Reiss 34:3b696c2b1e4b 137 }
Jason Reiss 34:3b696c2b1e4b 138
Jason Reiss 34:3b696c2b1e4b 139 if (trigger < 0 || trigger > 2) {
Jason Reiss 34:3b696c2b1e4b 140 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 34:3b696c2b1e4b 141 CommandTerminal::setErrorMessage("Invalid trigger, expects (0-2)");
Jason Reiss 34:3b696c2b1e4b 142 #endif
Jason Reiss 34:3b696c2b1e4b 143 return false;
Jason Reiss 34:3b696c2b1e4b 144 }
Jason Reiss 34:3b696c2b1e4b 145 }
Jason Reiss 34:3b696c2b1e4b 146
Mike Fiore 4:666017851052 147 return true;
Mike Fiore 4:666017851052 148 }
Mike Fiore 4:666017851052 149
Jason Reiss 28:c222ca8383f4 150 #if MTS_CMD_TERM_VERBOSE
Mike Fiore 14:f9a77400b622 151 CommandTerminal::setErrorMessage("Invalid arguments");
Jason Reiss 28:c222ca8383f4 152 #endif
Mike Fiore 4:666017851052 153 return false;
Mike Fiore 4:666017851052 154 }