Stable version of the mDot library for mbed 5. This version of the library is suitable for deployment scenarios. See lastest commit message for version of mbed-os library that has been tested against.

Dependents:   mdot_two_way unh-hackathon-example unh-hackathon-example-raw TelitSensorToCloud ... more

Fork of libmDot-dev-mbed5-deprecated by MultiTech

The Dot library provides a LoRaWan certified stack for LoRa communication using MultiTech mDot and xDot devices. The stack is compatible with mbed 5.

The name of the repository can be used to determine which device the stack was compiled for and if it's a development or production-ready build:

A changelog for the Dot library can be found here.

The Dot library version and the version of mbed-os it was compiled against can both be found in the commit message for that revision of the Dot library. Building your application with the same version of mbed-os as what was used to build the Dot library is highly recommended!

The Dot-Examples repository demonstrates how to use the Dot library in a custom application.

The mDot and xDot platform pages have lots of platform specific information and document potential issues, gotchas, etc, and provide instructions for getting started with development. Please take a look at the platform page before starting development as they should answer many questions you will have.

FOTA

Full FOTA support is only available with mDot, xDot does not have the required external flash. xDot can use the FOTA example to dynamically join a multicast session only. After joining the multicast session the received Fragmentation packets could be handed to a host MCU for processing and at completion the firmware can be loaded into the xDot using the bootloader and y-modem. See xDot Developer Guide.

  • Add the following code to allow Fota to use the Dot instance

main.cpp

    // Initialize FOTA singleton
    Fota::getInstance(dot);
  • Add fragmentation handling the the PacketRx event

RadioEvent.h

    virtual void PacketRx(uint8_t port, uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr, lora::DownlinkControl ctrl, uint8_t slot, uint8_t retries, uint32_t address, bool dupRx) {
        mDotEvent::PacketRx(port, payload, size, rssi, snr, ctrl, slot, retries, address, dupRx);

#if ACTIVE_EXAMPLE == FOTA_EXAMPLE
        if(port == 200 || port == 201 || port == 202) {
            Fota::getInstance()->processCmd(payload, port, size);
        }
#endif
    }

A definition is needed to enable Fragmentation support on mDot and save fragments to flash. This should not be defined for xDot and will result in a compiler error.

mbed_app.json

{
    "macros": [
        "FOTA=1"
    ]
}

The FOTA implementation has a few differences from the LoRaWAN Protocol

  • Fragmentation Indexing starts at 0
  • McKEKey is 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
  • Start Time is a count-down in seconds to start of session
Committer:
Jenkins@KEILDM1.dc.multitech.prv
Date:
Fri Nov 08 09:34:58 2019 -0600
Revision:
71:ae3afc16ec3e
Parent:
70:0c5b5b02d17b
Child:
72:b1e07ec1c30d
mdot-library revision 3.2.5 and mbed-os revision mbed-os-5.13.4

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 1 /*
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 2 / _____) _ | |
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 3 ( (____ _____ ____ _| |_ _____ ____| |__
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 5 _____) ) ____| | | || |_| ____( (___| | | |
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 7 (C)2013 Semtech
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 8
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 9 Description: Generic radio driver definition
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 10
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 11 License: Revised BSD License, see LICENSE.TXT file include in the project
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 12
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 13 Maintainer: Miguel Luis and Gregory Cristian
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 14 */
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 15 #ifndef __SXRADIOEVENTS_H__
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 16 #define __SXRADIOEVENTS_H__
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 17
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 18 /*!
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 19 * \brief Radio driver callback functions
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 20 */
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 21 class SxRadioEvents
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 22 {
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 23 public:
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 24 /*!
Jenkins@KEILDM1.dc.multitech.prv 64:64982192a2af 25 * \brief Tx Start callback prototype.
Jenkins@KEILDM1.dc.multitech.prv 64:64982192a2af 26 */
Jenkins@KEILDM1.dc.multitech.prv 64:64982192a2af 27 virtual void TxStart( void ) {}
Jenkins@KEILDM1.dc.multitech.prv 64:64982192a2af 28 /*!
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 29 * \brief Tx Done callback prototype.
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 30 */
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 31 virtual void TxDone( void ) {}
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 32 /*!
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 33 * \brief Tx Timeout callback prototype.
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 34 */
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 35 virtual void TxTimeout( void ) {}
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 36 /*!
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 37 * \brief Rx Done callback prototype.
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 38 *
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 39 * \param [IN] payload Received buffer pointer
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 40 * \param [IN] size Received buffer size
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 41 * \param [IN] rssi RSSI value computed while receiving the frame [dBm]
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 42 * \param [IN] snr Raw SNR value given by the radio hardware
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 43 * FSK : N/A ( set to 0 )
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 44 * LoRa: SNR value is two's complement in 1/4 dB
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 45 */
Jenkins@KEILDM1.dc.multitech.prv 70:0c5b5b02d17b 46 virtual void RxDone( uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr ) {}
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 47 /*!
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 48 * \brief Rx Timeout callback prototype.
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 49 */
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 50 virtual void RxTimeout( void ) {}
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 51 /*!
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 52 * \brief Rx Error callback prototype.
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 53 */
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 54 virtual void RxError( void ) {}
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 55 /*!
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 56 * \brief FHSS Change Channel callback prototype.
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 57 *
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 58 * \param [IN] currentChannel Index number of the current channel
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 59 */
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 60 virtual void FhssChangeChannel( uint8_t currentChannel ) {}
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 61 /*!
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 62 * \brief CAD Done callback prototype.
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 63 *
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 64 * \param [IN] channelActivityDetected Channel Activity detected during the CAD
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 65 */
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 66 virtual void CadDone( bool channelActivityDetected ) {}
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 67 /*!
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 68 * \brief Mac Event callback prototype.
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 69 */
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 70 virtual void MacEvent( void ) {}
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 71
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 72 virtual void LinkIdle(void) {}
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 73 };
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 74
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 75 #endif // __SXRADIOEVENTS_H__
Jenkins@KEILDM1.dc.multitech.prv 61:58ed1e136af5 76