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. Check the commit messages of the Dot library version used to find the correct mbed-os version to use with it. The mbed-os version must match the version used in that version of Dot library or it will likely cause it to fail to compile or have unexpected problems while running.

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 Jan 15 10:10:32 2025 -0600
Revision:
45:af9117557182
Parent:
36:b586cd6e91f3
Add xdot-ad bootloader

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jason Reiss 36:b586cd6e91f3 1 #if defined(MTS_RADIO_CTRL_COMMANDS) && defined(TARGET_XDOT_MAX32670)
Jason Reiss 36:b586cd6e91f3 2 #include "CmdInfPreamble.h"
Jason Reiss 36:b586cd6e91f3 3
Jason Reiss 36:b586cd6e91f3 4 CmdInfPreamble::CmdInfPreamble() :
Jason Reiss 36:b586cd6e91f3 5 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 36:b586cd6e91f3 6 Command("TX Infintie Preamble", "AT+INF", "Transmit LoRa Preamble Symbols Indefinitely [(0: stop, 1: start), power, frequency, bandwidth, spreading factor (5-12)]", "(0: stop, 1: start)")
Jason Reiss 36:b586cd6e91f3 7 #else
Jason Reiss 36:b586cd6e91f3 8 Command("AT+INF")
Jason Reiss 36:b586cd6e91f3 9 #endif
Jason Reiss 36:b586cd6e91f3 10 {
Jason Reiss 36:b586cd6e91f3 11 _queryable = true;
Jason Reiss 36:b586cd6e91f3 12 }
Jason Reiss 36:b586cd6e91f3 13
Jason Reiss 36:b586cd6e91f3 14 uint32_t CmdInfPreamble::action(const std::vector<std::string>& args)
Jason Reiss 36:b586cd6e91f3 15 {
Jason Reiss 36:b586cd6e91f3 16 uint32_t value;
Jason Reiss 36:b586cd6e91f3 17 if (args.size() == 1)
Jason Reiss 36:b586cd6e91f3 18 {
Jason Reiss 36:b586cd6e91f3 19 CommandTerminal::Serial()->writef("0x%02X\r\n", CommandTerminal::Dot()->getTxInfPreambleMode());
Jason Reiss 36:b586cd6e91f3 20 }
Jason Reiss 36:b586cd6e91f3 21 else if (args.size() == 2)
Jason Reiss 36:b586cd6e91f3 22 {
Jason Reiss 36:b586cd6e91f3 23
Jason Reiss 36:b586cd6e91f3 24 if (sscanf(args[1].c_str(), "%" PRIu32, &value) == 1)
Jason Reiss 36:b586cd6e91f3 25 {
Jason Reiss 36:b586cd6e91f3 26 CommandTerminal::Dot()->setTxInfPreambleMode(0, 0, 0, 0, 0);
Jason Reiss 36:b586cd6e91f3 27 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 36:b586cd6e91f3 28 CommandTerminal::Serial()->writef("Stopping Infinite Preamble\r\n");
Jason Reiss 36:b586cd6e91f3 29 #endif
Jason Reiss 36:b586cd6e91f3 30 } else {
Jason Reiss 36:b586cd6e91f3 31 return 1;
Jason Reiss 36:b586cd6e91f3 32 }
Jason Reiss 36:b586cd6e91f3 33 }
Jason Reiss 36:b586cd6e91f3 34 else if (args.size() == 5)
Jason Reiss 36:b586cd6e91f3 35 {
Jason Reiss 36:b586cd6e91f3 36 int frequency;
Jason Reiss 36:b586cd6e91f3 37 int power;
Jason Reiss 36:b586cd6e91f3 38 int bandwidth;
Jason Reiss 36:b586cd6e91f3 39 int spreadingFactor;
Jason Reiss 36:b586cd6e91f3 40
Jason Reiss 36:b586cd6e91f3 41 sscanf(args[1].c_str(), "%d", &frequency);
Jason Reiss 36:b586cd6e91f3 42 sscanf(args[2].c_str(), "%d", &power);
Jason Reiss 36:b586cd6e91f3 43 sscanf(args[3].c_str(), "%d", &bandwidth);
Jason Reiss 36:b586cd6e91f3 44 sscanf(args[4].c_str(), "%d", &spreadingFactor);
Jason Reiss 36:b586cd6e91f3 45 CommandTerminal::Dot()->setTxInfPreambleMode(1, frequency, power, bandwidth, uint8_t(spreadingFactor));
Jason Reiss 36:b586cd6e91f3 46 }
Jason Reiss 36:b586cd6e91f3 47
Jason Reiss 36:b586cd6e91f3 48 return 0;
Jason Reiss 36:b586cd6e91f3 49 }
Jason Reiss 36:b586cd6e91f3 50
Jason Reiss 36:b586cd6e91f3 51 bool CmdInfPreamble::verify(const std::vector<std::string>& args)
Jason Reiss 36:b586cd6e91f3 52 {
Jason Reiss 36:b586cd6e91f3 53 if (args.size() == 1)
Jason Reiss 36:b586cd6e91f3 54 return true;
Jason Reiss 36:b586cd6e91f3 55
Jason Reiss 36:b586cd6e91f3 56 if (args.size() == 2) {
Jason Reiss 36:b586cd6e91f3 57 uint32_t value;
Jason Reiss 36:b586cd6e91f3 58
Jason Reiss 36:b586cd6e91f3 59 if (sscanf(args[1].c_str(), "%" PRIu32 , &value) != 1) {
Jason Reiss 36:b586cd6e91f3 60 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 36:b586cd6e91f3 61 CommandTerminal::setErrorMessage("Invalid argument");
Jason Reiss 36:b586cd6e91f3 62 #endif
Jason Reiss 36:b586cd6e91f3 63 return false;
Jason Reiss 36:b586cd6e91f3 64 }
Jason Reiss 36:b586cd6e91f3 65
Jason Reiss 36:b586cd6e91f3 66 if (uint8_t(value) > 0) {
Jason Reiss 36:b586cd6e91f3 67 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 36:b586cd6e91f3 68 CommandTerminal::setErrorMessage("Invalid argument");
Jason Reiss 36:b586cd6e91f3 69 #endif
Jason Reiss 36:b586cd6e91f3 70 return false;
Jason Reiss 36:b586cd6e91f3 71 }
Jason Reiss 36:b586cd6e91f3 72
Jason Reiss 36:b586cd6e91f3 73 return true;
Jason Reiss 36:b586cd6e91f3 74 }
Jason Reiss 36:b586cd6e91f3 75
Jason Reiss 36:b586cd6e91f3 76 if(args.size() == 5) {
Jason Reiss 36:b586cd6e91f3 77 uint32_t value;
Jason Reiss 36:b586cd6e91f3 78
Jason Reiss 36:b586cd6e91f3 79 // power
Jason Reiss 36:b586cd6e91f3 80 if(sscanf(args[1].c_str(), "%" PRIu32 , &value ) != 1)
Jason Reiss 36:b586cd6e91f3 81 {
Jason Reiss 36:b586cd6e91f3 82 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 36:b586cd6e91f3 83 CommandTerminal::setErrorMessage("Invalid argument (power)");
Jason Reiss 36:b586cd6e91f3 84 #endif
Jason Reiss 36:b586cd6e91f3 85 return false;
Jason Reiss 36:b586cd6e91f3 86 }
Jason Reiss 36:b586cd6e91f3 87
Jason Reiss 36:b586cd6e91f3 88 if(value > 22)
Jason Reiss 36:b586cd6e91f3 89 {
Jason Reiss 36:b586cd6e91f3 90 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 36:b586cd6e91f3 91 CommandTerminal::setErrorMessage("Invalid argument (power)");
Jason Reiss 36:b586cd6e91f3 92 #endif
Jason Reiss 36:b586cd6e91f3 93 return false;
Jason Reiss 36:b586cd6e91f3 94 }
Jason Reiss 36:b586cd6e91f3 95
Jason Reiss 36:b586cd6e91f3 96 // frequency
Jason Reiss 36:b586cd6e91f3 97 if(sscanf(args[2].c_str(), "%" PRIu32 , &value ) != 1)
Jason Reiss 36:b586cd6e91f3 98 {
Jason Reiss 36:b586cd6e91f3 99 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 36:b586cd6e91f3 100 CommandTerminal::setErrorMessage("Invalid argument (freq)");
Jason Reiss 36:b586cd6e91f3 101 #endif
Jason Reiss 36:b586cd6e91f3 102 return false;
Jason Reiss 36:b586cd6e91f3 103 }
Jason Reiss 36:b586cd6e91f3 104
Jason Reiss 36:b586cd6e91f3 105 // bandwidth
Jason Reiss 36:b586cd6e91f3 106 if(sscanf(args[3].c_str(), "%" PRIu32 , &value ) != 1)
Jason Reiss 36:b586cd6e91f3 107 {
Jason Reiss 36:b586cd6e91f3 108 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 36:b586cd6e91f3 109 CommandTerminal::setErrorMessage("Invalid argument (bandwidth)");
Jason Reiss 36:b586cd6e91f3 110 #endif
Jason Reiss 36:b586cd6e91f3 111 return false;
Jason Reiss 36:b586cd6e91f3 112 }
Jason Reiss 36:b586cd6e91f3 113
Jason Reiss 36:b586cd6e91f3 114 if (!((value == 500000) || (value == 250000) || (value == 125000)))
Jason Reiss 36:b586cd6e91f3 115 {
Jason Reiss 36:b586cd6e91f3 116 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 36:b586cd6e91f3 117 CommandTerminal::setErrorMessage("Invalid argument (BW)");
Jason Reiss 36:b586cd6e91f3 118 #endif
Jason Reiss 36:b586cd6e91f3 119 return false;
Jason Reiss 36:b586cd6e91f3 120 }
Jason Reiss 36:b586cd6e91f3 121
Jason Reiss 36:b586cd6e91f3 122 // spreading factor
Jason Reiss 36:b586cd6e91f3 123 if(sscanf(args[4].c_str(), "%" PRIu32 , &value ) != 1)
Jason Reiss 36:b586cd6e91f3 124 {
Jason Reiss 36:b586cd6e91f3 125 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 36:b586cd6e91f3 126 CommandTerminal::setErrorMessage("Invalid argument (Spreading Factor)");
Jason Reiss 36:b586cd6e91f3 127 #endif
Jason Reiss 36:b586cd6e91f3 128 return false;
Jason Reiss 36:b586cd6e91f3 129 }
Jason Reiss 36:b586cd6e91f3 130 if (value > 0x0C)
Jason Reiss 36:b586cd6e91f3 131 {
Jason Reiss 36:b586cd6e91f3 132 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 36:b586cd6e91f3 133 CommandTerminal::setErrorMessage("Invalid argument (Spreading Factor greater than 12)");
Jason Reiss 36:b586cd6e91f3 134 #endif
Jason Reiss 36:b586cd6e91f3 135 return false;
Jason Reiss 36:b586cd6e91f3 136 }
Jason Reiss 36:b586cd6e91f3 137 return true;
Jason Reiss 36:b586cd6e91f3 138 }
Jason Reiss 36:b586cd6e91f3 139
Jason Reiss 36:b586cd6e91f3 140 #if MTS_CMD_TERM_VERBOSE
Jason Reiss 36:b586cd6e91f3 141 CommandTerminal::setErrorMessage("Invalid arguments");
Jason Reiss 36:b586cd6e91f3 142 #endif
Jason Reiss 36:b586cd6e91f3 143 return false;
Jason Reiss 36:b586cd6e91f3 144 }
Jason Reiss 36:b586cd6e91f3 145 #endif //MTS_RADIO_CTRL_COMMANDS