diff --git a/.travis.yml b/.travis.yml index c90572da..b8c626bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -326,6 +326,7 @@ script: - _notstm32l0 || arduino --verify --board $(_stm32l0opts 'mcci_catena_4618' us915 ) $MCCI_STM32_OPTS $PWD/examples/raw-halconfig/raw-halconfig.ino - _notstm32l0 || arduino --verify --board $(_stm32l0opts 'mcci_catena_4630' us915 ) $MCCI_STM32_OPTS $PWD/examples/raw-halconfig/raw-halconfig.ino - _notstm32l0 || arduino --verify --board $(_stm32l0opts 'mcci_catena_4801' us915 ) $MCCI_STM32_OPTS $PWD/examples/raw-halconfig/raw-halconfig.ino + - _notstm32l0 || arduino --verify --board $(_stm32l0opts 'mcci_catena_4802' us915 ) $MCCI_STM32_OPTS $PWD/examples/raw-halconfig/raw-halconfig.ino - _notstm32l0 || { _projcfg COMPILE_REGRESSION_TEST CFG_us915 CFG_sx1276_radio && arduino --verify --board $(_stm32l0opts 'mcci_catena_4551' projcfg) $MCCI_STM32_OPTS $PWD/examples/ttn-otaa-halconfig-us915/ttn-otaa-halconfig-us915.ino ; } - _notstm32l0 || { _projcfg COMPILE_REGRESSION_TEST CFG_us915 CFG_sx1276_radio && arduino --verify --board $(_stm32l0opts 'mcci_catena_4610' projcfg) $MCCI_STM32_OPTS $PWD/examples/ttn-otaa-halconfig-us915/ttn-otaa-halconfig-us915.ino ; } diff --git a/README.md b/README.md index d48e3260..cdd91857 100644 --- a/README.md +++ b/README.md @@ -35,73 +35,73 @@ requires C99 mode to be enabled by default. - [Installing](#installing) - [Features](#features) - [Additional Documentation](#additional-documentation) - - [PDF/Word Documentation](#pdfword-documentation) - - [Adding Regions](#adding-regions) - - [Known bugs and issues](#known-bugs-and-issues) - - [Timing Issues](#timing-issues) - - [Working with MCCI Murata-based boards](#working-with-mcci-murata-based-boards) - - [Event-Handling Issues](#event-handling-issues) + - [PDF/Word Documentation](#pdfword-documentation) + - [Adding Regions](#adding-regions) + - [Known bugs and issues](#known-bugs-and-issues) + - [Timing Issues](#timing-issues) + - [Working with MCCI Murata-based boards](#working-with-mcci-murata-based-boards) + - [Event-Handling Issues](#event-handling-issues) - [Configuration](#configuration) - - [Selecting the LoRaWAN Version](#selecting-the-lorawan-version) - - [Selecting V1.0.2](#selecting-v102) - - [Selecting V1.0.3](#selecting-v103) - - [Selecting the LoRaWAN Region Configuration](#selecting-the-lorawan-region-configuration) - - [eu868, as923, in866, kr920](#eu868-as923-in866-kr920) - - [us915, au915](#us915-au915) - - [Selecting the target radio transceiver](#selecting-the-target-radio-transceiver) - - [Controlling use of interrupts](#controlling-use-of-interrupts) - - [Disabling PING](#disabling-ping) - - [Disabling Beacons](#disabling-beacons) - - [Enabling Network Time Support](#enabling-network-time-support) - - [Rarely changed variables](#rarely-changed-variables) - - [Changing debug output](#changing-debug-output) - - [Getting debug from the RF library](#getting-debug-from-the-rf-library) - - [Selecting the AES library](#selecting-the-aes-library) - - [Defining the OS Tick Frequency](#defining-the-os-tick-frequency) - - [Setting the SPI-bus frequency](#setting-the-spi-bus-frequency) - - [Changing handling of runtime assertion failures](#changing-handling-of-runtime-assertion-failures) - - [Disabling JOIN](#disabling-join) - - [Disabling Class A MAC commands](#disabling-class-a-mac-commands) - - [Disabling Class B MAC commands](#disabling-class-b-mac-commands) - - [Disabling user events](#disabling-user-events) - - [Disabling external reference to `onEvent()`](#disabling-external-reference-to-onevent) - - [Enabling long messages](#enabling-long-messages) - - [Enabling LMIC event logging calls](#enabling-lmic-event-logging-calls) - - [Special purpose](#special-purpose) + - [Selecting the LoRaWAN Version](#selecting-the-lorawan-version) + - [Selecting V1.0.2](#selecting-v102) + - [Selecting V1.0.3](#selecting-v103) + - [Selecting the LoRaWAN Region Configuration](#selecting-the-lorawan-region-configuration) + - [eu868, as923, in866, kr920](#eu868-as923-in866-kr920) + - [us915, au915](#us915-au915) + - [Selecting the target radio transceiver](#selecting-the-target-radio-transceiver) + - [Controlling use of interrupts](#controlling-use-of-interrupts) + - [Disabling PING](#disabling-ping) + - [Disabling Beacons](#disabling-beacons) + - [Enabling Network Time Support](#enabling-network-time-support) + - [Rarely changed variables](#rarely-changed-variables) + - [Changing debug output](#changing-debug-output) + - [Getting debug from the RF library](#getting-debug-from-the-rf-library) + - [Selecting the AES library](#selecting-the-aes-library) + - [Defining the OS Tick Frequency](#defining-the-os-tick-frequency) + - [Setting the SPI-bus frequency](#setting-the-spi-bus-frequency) + - [Changing handling of runtime assertion failures](#changing-handling-of-runtime-assertion-failures) + - [Disabling JOIN](#disabling-join) + - [Disabling Class A MAC commands](#disabling-class-a-mac-commands) + - [Disabling Class B MAC commands](#disabling-class-b-mac-commands) + - [Disabling user events](#disabling-user-events) + - [Disabling external reference to `onEvent()`](#disabling-external-reference-to-onevent) + - [Enabling long messages](#enabling-long-messages) + - [Enabling LMIC event logging calls](#enabling-lmic-event-logging-calls) + - [Special purpose](#special-purpose) - [Supported hardware](#supported-hardware) - [Pre-Integrated Boards](#pre-integrated-boards) - [PlatformIO](#platformio) - [Manual configuration](#manual-configuration) - - [Power](#power) - - [SPI](#spi) - - [DIO pins](#dio-pins) - - [Reset](#reset) - - [RXTX](#rxtx) - - [RXTX Polarity](#rxtx-polarity) - - [Pin mapping](#pin-mapping) - - [Advanced initialization](#advanced-initialization) - - [HalConfiguration_t methods](#halconfiguration_t-methods) - - [LoRa Nexus by Ideetron](#lora-nexus-by-ideetron) + - [Power](#power) + - [SPI](#spi) + - [DIO pins](#dio-pins) + - [Reset](#reset) + - [RXTX](#rxtx) + - [RXTX Polarity](#rxtx-polarity) + - [Pin mapping](#pin-mapping) + - [Advanced initialization](#advanced-initialization) + - [HalConfiguration_t methods](#halconfiguration_t-methods) + - [LoRa Nexus by Ideetron](#lora-nexus-by-ideetron) - [Example Sketches](#example-sketches) - [Timing](#timing) - - [Controlling protocol timing](#controlling-protocol-timing) - - [`LMIC_setClockError()`](#lmic_setclockerror) - - [Interrupts and Arduino system timing](#interrupts-and-arduino-system-timing) + - [Controlling protocol timing](#controlling-protocol-timing) + - [`LMIC_setClockError()`](#lmic_setclockerror) + - [Interrupts and Arduino system timing](#interrupts-and-arduino-system-timing) - [Downlink data rate](#downlink-data-rate) - [Encoding Utilities](#encoding-utilities) - - [sflt16](#sflt16) - - [JavaScript decoder](#javascript-decoder) - - [uflt16](#uflt16) - - [uflt16 JavaScript decoder](#uflt16-javascript-decoder) - - [sflt12](#sflt12) - - [sflt12f JavaScript decoder](#sflt12f-javascript-decoder) - - [uflt12](#uflt12) - - [uflt12f JavaScript decoder](#uflt12f-javascript-decoder) + - [sflt16](#sflt16) + - [JavaScript decoder](#javascript-decoder) + - [uflt16](#uflt16) + - [uflt16 JavaScript decoder](#uflt16-javascript-decoder) + - [sflt12](#sflt12) + - [sflt12f JavaScript decoder](#sflt12f-javascript-decoder) + - [uflt12](#uflt12) + - [uflt12f JavaScript decoder](#uflt12f-javascript-decoder) - [Release History](#release-history) - [Contributions](#contributions) - [Trademark Acknowledgements](#trademark-acknowledgements) - [License](#license) - - [Support Open Source Hardware and Software](#support-open-source-hardware-and-software) + - [Support Open Source Hardware and Software](#support-open-source-hardware-and-software) @@ -455,7 +455,7 @@ The following boards are pre-integrated. - Adafruit [Feather 32u4 LoRa 900 MHz][1] (SX1276) - Adafruit [Feather M0 LoRa 900 MHz][2] (SX1276) - MCCI Catena 4410, 4420, [4450][3], [4460][4] and [4470][5] boards (based on Adafruit Feather boards plus wings) (SX1276) -- MCCI Catena 4551, [4610][6], 4611, [4612][7], 4617, [4618][7a], 4630, and [4801][8] boards (based on the Murata CMWX1ZZABZ-078 module) (SX1276) +- MCCI Catena 4551, [4610][6], 4611, [4612][7], 4617, [4618][7a], 4630, [4801][8] and 4802[12] boards (based on the Murata CMWX1ZZABZ-078 module) (SX1276) - [TTGo LoRa32 V1][10] (based on the ESP32) - [Heltec WiFi LoRa 32 V2][11] (based on the ESP32) @@ -470,6 +470,7 @@ The following boards are pre-integrated. [8]: https://store.mcci.com/collections/lorawan-iot-and-the-things-network/products/catena-4801 [10]: https://makeradvisor.com/tools/ttgo-lora32-sx1276-esp32-oled/ [11]: https://heltec.org/project/wifi-lora-32/ +[12]: https://store.mcci.com/collections/lorawan-iot-and-the-things-network/products/catena-4802 > To help you know if you have to worry, we'll call such boards "pre-integrated" and prefix each section with suitable guidance. diff --git a/src/arduino_lmic_hal_boards.h b/src/arduino_lmic_hal_boards.h index 01063984..4fc94c6d 100644 --- a/src/arduino_lmic_hal_boards.h +++ b/src/arduino_lmic_hal_boards.h @@ -35,6 +35,7 @@ const HalPinmap_t *GetPinmap_Catena4617(); const HalPinmap_t *GetPinmap_Catena4618(); const HalPinmap_t *GetPinmap_Catena4630(); const HalPinmap_t *GetPinmap_Catena4801(); +const HalPinmap_t *GetPinmap_Catena4802(); const HalPinmap_t* GetPinmap_ttgo_lora32_v1(); const HalPinmap_t* GetPinmap_heltec_lora32(); const HalPinmap_t* GetPinmap_Disco_L072cz_Lrwan1(); diff --git a/src/hal/getpinmap_catena4802.cpp b/src/hal/getpinmap_catena4802.cpp new file mode 100644 index 00000000..ef9d8d61 --- /dev/null +++ b/src/hal/getpinmap_catena4802.cpp @@ -0,0 +1,101 @@ +/* + +Module: getconfig_catena4802.cpp + +Function: + Arduino-LMIC C++ HAL pinmaps for various boards + +Copyright & License: + See accompanying LICENSE file. + +Author: + Dhinesh Kumar Pitchai, MCCI November 2020 + +*/ + +#if defined(ARDUINO_MCCI_CATENA_4802) || \ + /* legacy names */ \ + defined(ARDUINO_CATENA_4802) + +#include +#include + +#include "../lmic/oslmic.h" + +namespace Arduino_LMIC { + +class HalConfiguration_Catena4802_t : public HalConfiguration_t + { +public: + enum DIGITAL_PINS : uint8_t + { + PIN_SX1276_NSS = D7, + PIN_SX1276_NRESET = D8, + PIN_SX1276_DIO0 = D25, + PIN_SX1276_DIO1 = D26, + PIN_SX1276_DIO2 = D27, + PIN_SX1276_ANT_SWITCH_RX = D29, + PIN_SX1276_ANT_SWITCH_TX_BOOST = D30, + PIN_SX1276_ANT_SWITCH_TX_RFO = D31, + PIN_VDD_BOOST_ENABLE = A0, + PIN_TCXO_VDD = D33, + }; + + virtual void begin(void) override + { + digitalWrite(PIN_TCXO_VDD, 0); + pinMode(PIN_TCXO_VDD, OUTPUT); + } + + virtual void end(void) override + { + digitalWrite(PIN_TCXO_VDD, 0); + pinMode(PIN_TCXO_VDD, INPUT); + } + + virtual bool queryUsingTcxo(void) override { return true; }; + + virtual ostime_t setModuleActive(bool state) override + { + ostime_t result; + const int oldState = digitalRead(PIN_TCXO_VDD); + + // if turning on, we need to delay. + result = 0; + if (state && ! oldState) + result = ms2osticksCeil(3); + + if (state != oldState) + digitalWrite(PIN_TCXO_VDD, state); + + return result; + } + }; + +// save some typing by bringing the pin numbers into scope +static HalConfiguration_Catena4802_t myConfig; + +static const HalPinmap_t myPinmap = + { + .nss = HalConfiguration_Catena4802_t::PIN_SX1276_NSS, // chip select is D7 + .rxtx = HalConfiguration_Catena4802_t::PIN_SX1276_ANT_SWITCH_RX, // RXTX is D29 + .rst = HalConfiguration_Catena4802_t::PIN_SX1276_NRESET, // NRESET is D8 + + .dio = {HalConfiguration_Catena4802_t::PIN_SX1276_DIO0, // DIO0 (IRQ) is D25 + HalConfiguration_Catena4802_t::PIN_SX1276_DIO1, // DIO1 is D26 + HalConfiguration_Catena4802_t::PIN_SX1276_DIO2, // DIO2 is D27 + }, + .rxtx_rx_active = 1, + .rssi_cal = 10, + .spi_freq = 8000000, /* 8MHz */ + .pConfig = &myConfig + }; + +const HalPinmap_t *GetPinmap_Catena4802(void) + { + return &myPinmap; + } + +}; // namespace Arduino_LMIC + +#endif /* defined(ARDUINO_CATENA_4611) || defined(ARDUINO_CATENA_4802) */ diff --git a/src/hal/getpinmap_thisboard.cpp b/src/hal/getpinmap_thisboard.cpp index eea234b6..77f7d01c 100644 --- a/src/hal/getpinmap_thisboard.cpp +++ b/src/hal/getpinmap_thisboard.cpp @@ -55,6 +55,8 @@ const HalPinmap_t *GetPinmap_ThisBoard(void) return GetPinmap_Catena4630(); #elif defined(ARDUINO_MCCI_CATENA_4801) return GetPinmap_Catena4801(); +#elif defined(ARDUINO_MCCI_CATENA_4802) + return GetPinmap_Catena4802(); #elif defined(ARDUINO_DISCO_L072CZ_LRWAN1) return GetPinmap_Disco_L072cz_Lrwan1(); #elif defined(PINNOCHIO_SCOUT)