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:
Mike Fiore
Date:
Fri Nov 04 14:25:43 2016 -0500
Revision:
14:f9a77400b622
Parent:
9:ff62b20f7000
Child:
16:d5cf2af81a6d
update from git revision 2.0.16

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Mike Fiore 1:e52ae6584f1c 1 #include "CmdTxChannel.h"
Mike Fiore 1:e52ae6584f1c 2
Mike Fiore 14:f9a77400b622 3 CmdTxChannel::CmdTxChannel()
Mike Fiore 14:f9a77400b622 4 : Command("Tx Channels", "AT+TXCH", "List Tx channel frequencies for sub-band", "<INDEX>,<FREQUENCY>,<DR_RANGE>") {
Mike Fiore 1:e52ae6584f1c 5 _queryable = true;
Mike Fiore 1:e52ae6584f1c 6 }
Mike Fiore 1:e52ae6584f1c 7
Mike Fiore 1:e52ae6584f1c 8 uint32_t CmdTxChannel::action(std::vector<std::string> args) {
Mike Fiore 1:e52ae6584f1c 9 if (args.size() == 1) {
Mike Fiore 14:f9a77400b622 10
Mike Fiore 14:f9a77400b622 11 std::vector<uint32_t> channels = CommandTerminal::Dot()->getChannels();
Mike Fiore 14:f9a77400b622 12 std::vector<uint8_t> ranges = CommandTerminal::Dot()->getChannelRanges();
Mike Fiore 14:f9a77400b622 13 std::vector<uint16_t> mask = CommandTerminal::Dot()->getChannelMask();
Mike Fiore 14:f9a77400b622 14
Mike Fiore 14:f9a77400b622 15 CommandTerminal::Serial()->writef("Index\tFrequency DR Max Min On\r\n");
Mike Fiore 1:e52ae6584f1c 16
Mike Fiore 14:f9a77400b622 17 if (CommandTerminal::Dot()->getFrequencyBand() == mDot::FB_EU868) {
Mike Fiore 14:f9a77400b622 18 for (int8_t i = 0; i < 16; i++) {
Mike Fiore 14:f9a77400b622 19 if (channels[i] != 0)
Mike Fiore 14:f9a77400b622 20 CommandTerminal::Serial()->writef(" %d\t%d %X %X %d\r\n", i, channels[i], ranges[i] >> 4, ranges[i] & 0xF, (mask[0] & (0x1 << i)) ? 1 : 0);
Mike Fiore 14:f9a77400b622 21 else
Mike Fiore 14:f9a77400b622 22 CommandTerminal::Serial()->writef(" %d\t %d %X %X 0\r\n", i, channels[i], ranges[i] >> 4, ranges[i] & 0xF);
Mike Fiore 9:ff62b20f7000 23 }
Mike Fiore 14:f9a77400b622 24
Mike Fiore 14:f9a77400b622 25 if (channels[16] != 0)
Mike Fiore 14:f9a77400b622 26 CommandTerminal::Serial()->writef(" R2\t%d %X %X\r\n", channels[16], ranges[16] >> 4, ranges[16] & 0xF);
Mike Fiore 14:f9a77400b622 27 else
Mike Fiore 14:f9a77400b622 28 CommandTerminal::Serial()->writef(" R2\t %d %X %X\r\n", channels[16], ranges[16], ranges[168]);
Mike Fiore 1:e52ae6584f1c 29
Mike Fiore 1:e52ae6584f1c 30 } else {
Mike Fiore 14:f9a77400b622 31 if (CommandTerminal::Dot()->getFrequencySubBand() > 0) {
Mike Fiore 14:f9a77400b622 32 uint8_t offset = (CommandTerminal::Dot()->getFrequencySubBand() - 1) * 8;
Mike Fiore 9:ff62b20f7000 33
Mike Fiore 14:f9a77400b622 34 for (int i = 0; i < 8; i++) {
Mike Fiore 14:f9a77400b622 35 if ((CommandTerminal::Dot()->getFrequencySubBand() % 2) == 1) {
Mike Fiore 14:f9a77400b622 36 CommandTerminal::Serial()->writef(" %d\t%d %X %X %d\r\n", i, channels[i], ranges[i] >> 4, ranges[i] & 0xF, (mask[(offset + i)/16] & (0x0001 << i)) ? 1 : 0);
Mike Fiore 14:f9a77400b622 37 } else {
Mike Fiore 14:f9a77400b622 38 CommandTerminal::Serial()->writef(" %d\t%d %X %X %d\r\n", i, channels[i], ranges[i] >> 4, ranges[i] & 0xF, (mask[(offset + i)/16] & (0x0001 << (i + 8))) ? 1 : 0);
Mike Fiore 14:f9a77400b622 39 }
Mike Fiore 14:f9a77400b622 40 }
Mike Fiore 14:f9a77400b622 41
Mike Fiore 14:f9a77400b622 42 CommandTerminal::Serial()->writef(" U\t%d %X %X %d\r\n", channels[8], ranges[8] >> 4, ranges[8] & 0xF, (mask[4] & (0x0001 << (CommandTerminal::Dot()->getFrequencySubBand() - 1))) ? 1 : 0);
Mike Fiore 14:f9a77400b622 43 CommandTerminal::Serial()->writef(" R2\t%d %X %X\r\n", channels[9], ranges[9], ranges[9]);
Mike Fiore 14:f9a77400b622 44 } else {
Mike Fiore 14:f9a77400b622 45 for (size_t i = 0; i < channels.size() - 1; i++) {
Mike Fiore 14:f9a77400b622 46 CommandTerminal::Serial()->writef(" %d\t%d %X %X %d\r\n", i, channels[i], ranges[i] >> 4, ranges[i] & 0xF, (mask[i/16] & (0x0001 << (i%16))) ? 1 : 0);
Mike Fiore 14:f9a77400b622 47 }
Mike Fiore 14:f9a77400b622 48 uint8_t last = channels.size() - 1;
Mike Fiore 14:f9a77400b622 49 CommandTerminal::Serial()->writef(" R2\t%d %X %X\r\n", channels[last], ranges[last], ranges[last]);
Mike Fiore 9:ff62b20f7000 50 }
Mike Fiore 1:e52ae6584f1c 51 }
Mike Fiore 1:e52ae6584f1c 52 }
Mike Fiore 1:e52ae6584f1c 53
Mike Fiore 9:ff62b20f7000 54 if (args.size() == 4) {
Mike Fiore 9:ff62b20f7000 55 int index;
Mike Fiore 9:ff62b20f7000 56 int frequency;
Mike Fiore 9:ff62b20f7000 57 int datarateRange;
Mike Fiore 9:ff62b20f7000 58
Mike Fiore 9:ff62b20f7000 59 sscanf(args[1].c_str(), "%d", &index);
Mike Fiore 9:ff62b20f7000 60 sscanf(args[2].c_str(), "%d", &frequency);
Mike Fiore 9:ff62b20f7000 61 sscanf(args[3].c_str(), "%02x", &datarateRange);
Mike Fiore 9:ff62b20f7000 62
Mike Fiore 14:f9a77400b622 63 CommandTerminal::Dot()->addChannel(index, frequency, datarateRange);
Mike Fiore 9:ff62b20f7000 64 }
Mike Fiore 9:ff62b20f7000 65
Mike Fiore 1:e52ae6584f1c 66 return 0;
Mike Fiore 1:e52ae6584f1c 67 }
Mike Fiore 1:e52ae6584f1c 68
Mike Fiore 9:ff62b20f7000 69 bool CmdTxChannel::verify(std::vector<std::string> args) {
Mike Fiore 9:ff62b20f7000 70 if (args.size() == 1)
Mike Fiore 9:ff62b20f7000 71 return true;
Mike Fiore 9:ff62b20f7000 72
Mike Fiore 9:ff62b20f7000 73 if (args.size() == 4) {
Mike Fiore 9:ff62b20f7000 74
Mike Fiore 9:ff62b20f7000 75 int index;
Mike Fiore 9:ff62b20f7000 76 int frequency;
Mike Fiore 9:ff62b20f7000 77 int datarateRange;
Mike Fiore 9:ff62b20f7000 78
Mike Fiore 9:ff62b20f7000 79 sscanf(args[1].c_str(), "%d", &index);
Mike Fiore 9:ff62b20f7000 80 sscanf(args[2].c_str(), "%d", &frequency);
Mike Fiore 9:ff62b20f7000 81 sscanf(args[3].c_str(), "%02x", &datarateRange);
Mike Fiore 9:ff62b20f7000 82
Mike Fiore 14:f9a77400b622 83 if (CommandTerminal::Dot()->getFrequencyBand() == mDot::FB_EU868) {
Mike Fiore 9:ff62b20f7000 84 if (index < 3 || index > 15) {
Mike Fiore 14:f9a77400b622 85 CommandTerminal::setErrorMessage("Invalid index, expects (3-15)");
Mike Fiore 9:ff62b20f7000 86 return false;
Mike Fiore 9:ff62b20f7000 87 }
Mike Fiore 9:ff62b20f7000 88
Mike Fiore 9:ff62b20f7000 89 if (frequency != 0 && (frequency < 863000000 || frequency > 870000000)) {
Mike Fiore 14:f9a77400b622 90 CommandTerminal::setErrorMessage("Invalid frequency, expects (863000000-870000000)");
Mike Fiore 9:ff62b20f7000 91 return false;
Mike Fiore 9:ff62b20f7000 92 }
Mike Fiore 9:ff62b20f7000 93 } else {
Mike Fiore 14:f9a77400b622 94 CommandTerminal::setErrorMessage("US915|AU915 Channels cannot be changed, use AT+FSB or AT+CHM to limit");
Mike Fiore 9:ff62b20f7000 95 return false;
Mike Fiore 9:ff62b20f7000 96 }
Mike Fiore 9:ff62b20f7000 97
Mike Fiore 9:ff62b20f7000 98 return true;
Mike Fiore 9:ff62b20f7000 99 } else {
Mike Fiore 14:f9a77400b622 100 CommandTerminal::setErrorMessage("Invalid arguments");
Mike Fiore 9:ff62b20f7000 101 return false;
Mike Fiore 9:ff62b20f7000 102 }
Mike Fiore 9:ff62b20f7000 103
Mike Fiore 9:ff62b20f7000 104 }