From 0cfeeba2e28ebbedfad56fd10ecf62f0a8462a8b Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 16 Aug 2020 13:25:24 -0700 Subject: [PATCH 01/15] add variant files by @BigCorvus --- variants/lora-relay-v1/variant.cpp | 107 ++++++++++++++++++++++ variants/lora-relay-v1/variant.h | 141 +++++++++++++++++++++++++++++ 2 files changed, 248 insertions(+) create mode 100644 variants/lora-relay-v1/variant.cpp create mode 100644 variants/lora-relay-v1/variant.h diff --git a/variants/lora-relay-v1/variant.cpp b/variants/lora-relay-v1/variant.cpp new file mode 100644 index 00000000..fdb60927 --- /dev/null +++ b/variants/lora-relay-v1/variant.cpp @@ -0,0 +1,107 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "variant.h" +#include "wiring_constants.h" +#include "wiring_digital.h" +#include "nrf.h" + +const uint32_t g_ADigitalPinMap[] = +{ + // D0 .. D13 + 25, // D0 is P0.25 (UART TX) + 24, // D1 is P0.24 (UART RX + 10, // D2 is P0.10 (NFC2) + 47, // D3 is P1.15 (LED1) + 42, // D4 is P1.10 (LED2) + 40, // D5 is P1.08 + 7, // D6 is P0.07 + 34, // D7 is P1.02 (Button) + 16, // D8 is P0.16 (NeoPixel) + 26, // D9 is P0.26 + 27, // D10 is P0.27 + 6, // D11 is P0.06 + 8, // D12 is P0.08 + 41, // D13 is P1.09 + + // D14 .. D21 (aka A0 .. A7) + 4, // D14 is P0.04 (A0) + 5, // D15 is P0.05 (A1) + 30, // D16 is P0.30 (A2) + 28, // D17 is P0.28 (A3) + 2, // D18 is P0.02 (A4) + 3, // D19 is P0.03 (A5) + 29, // D20 is P0.29 (A6, Battery) + 31, // D21 is P0.31 (A7, ARef) + + // D22 .. D23 (aka I2C pins) + 12, // D22 is P0.12 (SDA) + 11, // D23 is P0.11 (SCL) + + // D24 .. D26 (aka SPI pins) + 15, // D24 is P0.15 (SPI MISO) + 13, // D25 is P0.13 (SPI MOSI) + 14, // D26 is P0.14 (SPI SCK ) + + // QSPI pins (not exposed via any header / test point) + 19, // D27 is P0.19 (QSPI CLK) + 20, // D28 is P0.20 (QSPI CS) + 17, // D29 is P0.17 (QSPI Data 0) + 22, // D30 is P0.22 (QSPI Data 1) + 23, // D31 is P0.23 (QSPI Data 2) + 21, // D32 is P0.21 (QSPI Data 3) + + // The remaining NFC pin + 9, // D33 is P0.09 (NFC1, exposed only via test point on bottom of board) + + // Thus, there are 34 defined pins + + // The remaining pins are not usable: + // + // + // The following pins were never listed as they were considered unusable + 0, // P0.00 is XL1 (attached to 32.768kHz crystal) + 1, // P0.01 is XL2 (attached to 32.768kHz crystal) + 18, // P0.18 is RESET (attached to switch) + 32, // P1.00 is SWO (attached to debug header) + + // The remaining pins are not connected (per schematic) + 33, //D38 is P1.01 is not connected per schematic + 35, //D39 is P1.03 is not connected per schematic + 36, //D40 P1.04 is not connected per schematic + 37, //D41 P1.05 is not connected per schematic + 38, //D42 P1.06 is not connected per schematic + 39, //D43 P1.07 is not connected per schematic + 43, //D44 P1.11 is not connected per schematic + 44, //D45 is P1.12 is not connected per schematic + 45, //D46 P1.13 is not connected per schematic + 46, //D47 is P1.14 is not connected per schematic +}; + +void initVariant() +{ + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); +} + diff --git a/variants/lora-relay-v1/variant.h b/variants/lora-relay-v1/variant.h new file mode 100644 index 00000000..a63d606b --- /dev/null +++ b/variants/lora-relay-v1/variant.h @@ -0,0 +1,141 @@ + /* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _VARIANT_FEATHER52840_ +#define _VARIANT_FEATHER52840_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (48) +#define NUM_DIGITAL_PINS (48) +#define NUM_ANALOG_INPUTS (6) // A6 is used for battery, A7 is analog reference +#define NUM_ANALOG_OUTPUTS (0) + +// LEDs +#define PIN_LED1 (3) +#define PIN_LED2 (4) +#define PIN_NEOPIXEL (8) + +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 + +#define LED_RED PIN_LED1 +#define LED_BLUE PIN_LED2 + +#define LED_STATE_ON 1 // State when LED is litted + +/* + * Buttons + */ +#define PIN_BUTTON1 (7) + +/* + * Analog pins + */ +#define PIN_A0 (14) +#define PIN_A1 (15) +#define PIN_A2 (16) +#define PIN_A3 (17) +#define PIN_A4 (18) +#define PIN_A5 (19) +#define PIN_A6 (20) +#define PIN_A7 (21) + +static const uint8_t A0 = PIN_A0 ; +static const uint8_t A1 = PIN_A1 ; +static const uint8_t A2 = PIN_A2 ; +static const uint8_t A3 = PIN_A3 ; +static const uint8_t A4 = PIN_A4 ; +static const uint8_t A5 = PIN_A5 ; +static const uint8_t A6 = PIN_A6 ; +static const uint8_t A7 = PIN_A7 ; +#define ADC_RESOLUTION 14 + +// Other pins +#define PIN_AREF PIN_A7 +#define PIN_VBAT PIN_A6 +#define PIN_NFC1 (33) +#define PIN_NFC2 (2) + +static const uint8_t AREF = PIN_AREF; + +/* + * Serial interfaces + */ +#define PIN_SERIAL1_RX (1) +#define PIN_SERIAL1_TX (0) + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (24) +#define PIN_SPI_MOSI (25) +#define PIN_SPI_SCK (26) + +static const uint8_t SS = (5); +static const uint8_t MOSI = PIN_SPI_MOSI ; +static const uint8_t MISO = PIN_SPI_MISO ; +static const uint8_t SCK = PIN_SPI_SCK ; + +/* + * Wire Interfaces + */ +#define WIRE_INTERFACES_COUNT 1 + +#define PIN_WIRE_SDA (22) +#define PIN_WIRE_SCL (23) + +// QSPI Pins +#define PIN_QSPI_SCK 27 +#define PIN_QSPI_CS 28 +#define PIN_QSPI_IO0 29 +#define PIN_QSPI_IO1 30 +#define PIN_QSPI_IO2 31 +#define PIN_QSPI_IO3 32 + +// On-board QSPI Flash +#define EXTERNAL_FLASH_DEVICES GD25Q16C +#define EXTERNAL_FLASH_USE_QSPI + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#endif From 08e5bd728baf43d10bf6e21ed25cb8f41acf4791 Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 16 Aug 2020 14:07:01 -0700 Subject: [PATCH 02/15] lorarelay wip --- variants/lora-relay-v1/variant.cpp | 138 +++++++++++++-------------- variants/lora-relay-v1/variant.h | 147 ++++++++++++++--------------- 2 files changed, 141 insertions(+), 144 deletions(-) diff --git a/variants/lora-relay-v1/variant.cpp b/variants/lora-relay-v1/variant.cpp index fdb60927..03ac587a 100644 --- a/variants/lora-relay-v1/variant.cpp +++ b/variants/lora-relay-v1/variant.cpp @@ -19,89 +19,87 @@ */ #include "variant.h" +#include "nrf.h" #include "wiring_constants.h" #include "wiring_digital.h" -#include "nrf.h" -const uint32_t g_ADigitalPinMap[] = -{ - // D0 .. D13 - 25, // D0 is P0.25 (UART TX) - 24, // D1 is P0.24 (UART RX - 10, // D2 is P0.10 (NFC2) - 47, // D3 is P1.15 (LED1) - 42, // D4 is P1.10 (LED2) - 40, // D5 is P1.08 - 7, // D6 is P0.07 - 34, // D7 is P1.02 (Button) - 16, // D8 is P0.16 (NeoPixel) - 26, // D9 is P0.26 - 27, // D10 is P0.27 - 6, // D11 is P0.06 - 8, // D12 is P0.08 - 41, // D13 is P1.09 +const uint32_t g_ADigitalPinMap[] = { + // D0 .. D13 + 25, // D0 is P0.25 (UART TX) + 24, // D1 is P0.24 (UART RX + 10, // D2 is P0.10 (NFC2) + 47, // D3 is P1.15 (LED1) + 42, // D4 is P1.10 (LED2) + 40, // D5 is P1.08 + 7, // D6 is P0.07 + 34, // D7 is P1.02 (Button) + 16, // D8 is P0.16 (NeoPixel) + 26, // D9 is P0.26 + 27, // D10 is P0.27 + 6, // D11 is P0.06 D_RES (IPS display reset) + 8, // D12 is P0.08 D_CS (IPS display chip select) + 41, // D13 is P1.09 BLT (IPS display backlight) - // D14 .. D21 (aka A0 .. A7) - 4, // D14 is P0.04 (A0) - 5, // D15 is P0.05 (A1) - 30, // D16 is P0.30 (A2) - 28, // D17 is P0.28 (A3) - 2, // D18 is P0.02 (A4) - 3, // D19 is P0.03 (A5) - 29, // D20 is P0.29 (A6, Battery) - 31, // D21 is P0.31 (A7, ARef) + // D14 .. D21 (aka A0 .. A7) + 4, // D14 is P0.04 (A0) + 5, // D15 is P0.05 (A1) + 30, // D16 is P0.30 (A2) + 28, // D17 is P0.28 (A3) + 2, // D18 is P0.02 (A4) + 3, // D19 is P0.03 (A5) + 29, // D20 is P0.29 (A6, Battery) + 31, // D21 is P0.31 (A7, ARef) - // D22 .. D23 (aka I2C pins) - 12, // D22 is P0.12 (SDA) - 11, // D23 is P0.11 (SCL) + // D22 .. D23 (aka I2C pins) + 12, // D22 is P0.12 (SDA) + 11, // D23 is P0.11 (SCL) - // D24 .. D26 (aka SPI pins) - 15, // D24 is P0.15 (SPI MISO) - 13, // D25 is P0.13 (SPI MOSI) - 14, // D26 is P0.14 (SPI SCK ) + // D24 .. D26 (aka SPI pins) + 15, // D24 is P0.15 (SPI MISO) + 13, // D25 is P0.13 (SPI MOSI) + 14, // D26 is P0.14 (SPI SCK ) - // QSPI pins (not exposed via any header / test point) - 19, // D27 is P0.19 (QSPI CLK) - 20, // D28 is P0.20 (QSPI CS) - 17, // D29 is P0.17 (QSPI Data 0) - 22, // D30 is P0.22 (QSPI Data 1) - 23, // D31 is P0.23 (QSPI Data 2) - 21, // D32 is P0.21 (QSPI Data 3) + // QSPI pins (not exposed via any header / test point) + // 19, // P0.19 (QSPI CLK) + // 20, // P0.20 (QSPI CS) + // 17, // P0.17 (QSPI Data 0) + // 22, // P0.22 (QSPI Data 1) + // 23, // P0.23 (QSPI Data 2) + // 21, // P0.21 (QSPI Data 3) - // The remaining NFC pin - 9, // D33 is P0.09 (NFC1, exposed only via test point on bottom of board) + // The remaining NFC pin + 9, // D27 P0.09 (NFC1, exposed only via test point on bottom of board) - // Thus, there are 34 defined pins + // The following pins were never listed as they were considered unusable + // 0, // P0.00 is XL1 (attached to 32.768kHz crystal) Never expose as GPIOs + // 1, // P0.01 is XL2 (attached to 32.768kHz crystal) + 18, // D28 P0.18 is RESET (attached to switch) + // 32, // P1.00 is SWO (attached to debug header) - // The remaining pins are not usable: - // - // - // The following pins were never listed as they were considered unusable - 0, // P0.00 is XL1 (attached to 32.768kHz crystal) - 1, // P0.01 is XL2 (attached to 32.768kHz crystal) - 18, // P0.18 is RESET (attached to switch) - 32, // P1.00 is SWO (attached to debug header) - - // The remaining pins are not connected (per schematic) - 33, //D38 is P1.01 is not connected per schematic - 35, //D39 is P1.03 is not connected per schematic - 36, //D40 P1.04 is not connected per schematic - 37, //D41 P1.05 is not connected per schematic - 38, //D42 P1.06 is not connected per schematic - 39, //D43 P1.07 is not connected per schematic - 43, //D44 P1.11 is not connected per schematic - 44, //D45 is P1.12 is not connected per schematic - 45, //D46 P1.13 is not connected per schematic - 46, //D47 is P1.14 is not connected per schematic + // D29-D43 + 27, // P0.27 E22-SX1262 DIO1 + 28, // P0.28 E22-SX1262 DIO2 + 30, // P0.30 E22-SX1262 TXEN + 32 + 1, // P1.01 BTN_UP + 32 + 2, // P1.02 SWITCH + 35, // P1.03 E22-SX1262 NSS + 36, // P1.04 is not connected per schematic + 37, // P1.05 is not connected per schematic + 38, // P1.06 is not connected per schematic + 39, // P1.07 is not connected per schematic + 32 + 8, // P1.08 E22-SX1262 BUSY + 43, // P1.11 is not connected per schematic + 32 + 12, // P1.12 E22-SX1262 RESET + 45, // P1.13 is not connected per schematic + 46, // P1.14 is not connected per schematic }; void initVariant() { - // LED1 & LED2 - pinMode(PIN_LED1, OUTPUT); - ledOff(PIN_LED1); + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); - pinMode(PIN_LED2, OUTPUT); - ledOff(PIN_LED2); + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); } - diff --git a/variants/lora-relay-v1/variant.h b/variants/lora-relay-v1/variant.h index a63d606b..06e59d02 100644 --- a/variants/lora-relay-v1/variant.h +++ b/variants/lora-relay-v1/variant.h @@ -1,28 +1,28 @@ - /* - Copyright (c) 2014-2015 Arduino LLC. All right reserved. - Copyright (c) 2016 Sandeep Mistry All right reserved. - Copyright (c) 2018, Adafruit Industries (adafruit.com) +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _VARIANT_FEATHER52840_ -#define _VARIANT_FEATHER52840_ +#ifndef _VARIANT_LORA_RELAY_V1_ +#define _VARIANT_LORA_RELAY_V1_ /** Master clock frequency */ -#define VARIANT_MCK (64000000ul) +#define VARIANT_MCK (64000000ul) -#define USE_LFXO // Board uses 32khz crystal for LF +#define USE_LFXO // Board uses 32khz crystal for LF // define USE_LFRC // Board uses RC for LF /*---------------------------------------------------------------------------- @@ -32,103 +32,102 @@ #include "WVariant.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif // __cplusplus // Number of pins defined in PinDescription array -#define PINS_COUNT (48) -#define NUM_DIGITAL_PINS (48) -#define NUM_ANALOG_INPUTS (6) // A6 is used for battery, A7 is analog reference -#define NUM_ANALOG_OUTPUTS (0) +#define PINS_COUNT (43) +#define NUM_DIGITAL_PINS (43) +#define NUM_ANALOG_INPUTS (8) // A6 is used for battery, A7 is analog reference +#define NUM_ANALOG_OUTPUTS (0) // LEDs -#define PIN_LED1 (3) -#define PIN_LED2 (4) -#define PIN_NEOPIXEL (8) +#define PIN_LED1 (3) +#define PIN_LED2 (4) +#define PIN_NEOPIXEL (8) -#define LED_BUILTIN PIN_LED1 -#define LED_CONN PIN_LED2 +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 -#define LED_RED PIN_LED1 -#define LED_BLUE PIN_LED2 +#define LED_RED PIN_LED1 +#define LED_BLUE PIN_LED2 -#define LED_STATE_ON 1 // State when LED is litted +#define LED_STATE_ON 1 // State when LED is litted /* * Buttons */ -#define PIN_BUTTON1 (7) +#define PIN_BUTTON1 (7) /* * Analog pins */ -#define PIN_A0 (14) -#define PIN_A1 (15) -#define PIN_A2 (16) -#define PIN_A3 (17) -#define PIN_A4 (18) -#define PIN_A5 (19) -#define PIN_A6 (20) -#define PIN_A7 (21) +#define PIN_A0 (14) +#define PIN_A1 (15) +#define PIN_A2 (16) +#define PIN_A3 (17) +#define PIN_A4 (18) +#define PIN_A5 (19) +#define PIN_A6 (20) +#define PIN_A7 (21) -static const uint8_t A0 = PIN_A0 ; -static const uint8_t A1 = PIN_A1 ; -static const uint8_t A2 = PIN_A2 ; -static const uint8_t A3 = PIN_A3 ; -static const uint8_t A4 = PIN_A4 ; -static const uint8_t A5 = PIN_A5 ; -static const uint8_t A6 = PIN_A6 ; -static const uint8_t A7 = PIN_A7 ; -#define ADC_RESOLUTION 14 +static const uint8_t A0 = PIN_A0; +static const uint8_t A1 = PIN_A1; +static const uint8_t A2 = PIN_A2; +static const uint8_t A3 = PIN_A3; +static const uint8_t A4 = PIN_A4; +static const uint8_t A5 = PIN_A5; +static const uint8_t A6 = PIN_A6; +static const uint8_t A7 = PIN_A7; +#define ADC_RESOLUTION 14 // Other pins -#define PIN_AREF PIN_A7 -#define PIN_VBAT PIN_A6 -#define PIN_NFC1 (33) -#define PIN_NFC2 (2) +#define PIN_AREF PIN_A7 +#define PIN_VBAT PIN_A6 +#define PIN_NFC1 (33) +#define PIN_NFC2 (2) static const uint8_t AREF = PIN_AREF; /* * Serial interfaces */ -#define PIN_SERIAL1_RX (1) -#define PIN_SERIAL1_TX (0) +#define PIN_SERIAL1_RX (1) +#define PIN_SERIAL1_TX (0) /* * SPI Interfaces */ #define SPI_INTERFACES_COUNT 1 -#define PIN_SPI_MISO (24) -#define PIN_SPI_MOSI (25) -#define PIN_SPI_SCK (26) +#define PIN_SPI_MISO (24) +#define PIN_SPI_MOSI (25) +#define PIN_SPI_SCK (26) -static const uint8_t SS = (5); -static const uint8_t MOSI = PIN_SPI_MOSI ; -static const uint8_t MISO = PIN_SPI_MISO ; -static const uint8_t SCK = PIN_SPI_SCK ; +static const uint8_t SS = (5); +static const uint8_t MOSI = PIN_SPI_MOSI; +static const uint8_t MISO = PIN_SPI_MISO; +static const uint8_t SCK = PIN_SPI_SCK; /* * Wire Interfaces */ #define WIRE_INTERFACES_COUNT 1 -#define PIN_WIRE_SDA (22) -#define PIN_WIRE_SCL (23) +#define PIN_WIRE_SDA (22) +#define PIN_WIRE_SCL (23) // QSPI Pins -#define PIN_QSPI_SCK 27 -#define PIN_QSPI_CS 28 -#define PIN_QSPI_IO0 29 -#define PIN_QSPI_IO1 30 -#define PIN_QSPI_IO2 31 -#define PIN_QSPI_IO3 32 +//#define PIN_QSPI_SCK 27 +//#define PIN_QSPI_CS 28 +//#define PIN_QSPI_IO0 29 +//#define PIN_QSPI_IO1 30 +//#define PIN_QSPI_IO2 31 +//#define PIN_QSPI_IO3 32 // On-board QSPI Flash -#define EXTERNAL_FLASH_DEVICES GD25Q16C -#define EXTERNAL_FLASH_USE_QSPI +//#define EXTERNAL_FLASH_DEVICES GD25Q16C +//#define EXTERNAL_FLASH_USE_QSPI #ifdef __cplusplus } From 559a7902864e7faba22c628fdc3eb08d9c35aafe Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 16 Aug 2020 14:08:31 -0700 Subject: [PATCH 03/15] Add @BigCorvus board support to build --- platformio.ini | 10 +++++++++- variants/{lora-relay-v1 => lora_relay_v1}/variant.cpp | 0 variants/{lora-relay-v1 => lora_relay_v1}/variant.h | 0 3 files changed, 9 insertions(+), 1 deletion(-) rename variants/{lora-relay-v1 => lora_relay_v1}/variant.cpp (100%) rename variants/{lora-relay-v1 => lora_relay_v1}/variant.h (100%) diff --git a/platformio.ini b/platformio.ini index 56efa748..4a66d1bf 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,7 +9,7 @@ ; https://docs.platformio.org/page/projectconf.html [platformio] -default_envs = tbeam +default_envs = lora-relay-v1 [common] ; common is not currently used @@ -212,6 +212,14 @@ lib_deps = ${env.lib_deps} UC1701 +; The https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay board by @BigCorvus +[env:lora-relay-v1] +extends = nrf52_base +board = lora-relay-v1 +lib_deps = + ${env.lib_deps} + + diff --git a/variants/lora-relay-v1/variant.cpp b/variants/lora_relay_v1/variant.cpp similarity index 100% rename from variants/lora-relay-v1/variant.cpp rename to variants/lora_relay_v1/variant.cpp diff --git a/variants/lora-relay-v1/variant.h b/variants/lora_relay_v1/variant.h similarity index 100% rename from variants/lora-relay-v1/variant.h rename to variants/lora_relay_v1/variant.h From 67bad9a689e21f3e6406061b392c44773dfb9d0e Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 16 Aug 2020 14:20:05 -0700 Subject: [PATCH 04/15] Add SX1262 to @BigCorvus board --- variants/lora_relay_v1/variant.cpp | 28 +++++++++---------- variants/lora_relay_v1/variant.h | 45 +++++++++++++++--------------- 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/variants/lora_relay_v1/variant.cpp b/variants/lora_relay_v1/variant.cpp index 03ac587a..dd275021 100644 --- a/variants/lora_relay_v1/variant.cpp +++ b/variants/lora_relay_v1/variant.cpp @@ -39,16 +39,16 @@ const uint32_t g_ADigitalPinMap[] = { 6, // D11 is P0.06 D_RES (IPS display reset) 8, // D12 is P0.08 D_CS (IPS display chip select) 41, // D13 is P1.09 BLT (IPS display backlight) + 4, // D14 is P0.04 SX1262 RXEN // D14 .. D21 (aka A0 .. A7) - 4, // D14 is P0.04 (A0) - 5, // D15 is P0.05 (A1) - 30, // D16 is P0.30 (A2) - 28, // D17 is P0.28 (A3) - 2, // D18 is P0.02 (A4) - 3, // D19 is P0.03 (A5) - 29, // D20 is P0.29 (A6, Battery) - 31, // D21 is P0.31 (A7, ARef) + 5, // D15 is P0.05 (A0) + 30, // D16 is P0.30 (A1) + 28, // D17 is P0.28 (A2) + 2, // D18 is P0.02 (A3) + 3, // D19 is P0.03 (A4) + 29, // D20 is P0.29 (A5, Battery) + 31, // D21 is P0.31 (A6, ARef) // D22 .. D23 (aka I2C pins) 12, // D22 is P0.12 (SDA) @@ -77,19 +77,19 @@ const uint32_t g_ADigitalPinMap[] = { // 32, // P1.00 is SWO (attached to debug header) // D29-D43 - 27, // P0.27 E22-SX1262 DIO1 - 28, // P0.28 E22-SX1262 DIO2 - 30, // P0.30 E22-SX1262 TXEN + 27, // D29 P0.27 E22-SX1262 DIO1 + 28, // D30 P0.28 E22-SX1262 DIO2 + 30, // D31 P0.30 E22-SX1262 TXEN + 35, // D32 P1.03 E22-SX1262 NSS + 32 + 8, // D33 P1.08 E22-SX1262 BUSY + 32 + 12, // D34 P1.12 E22-SX1262 RESET 32 + 1, // P1.01 BTN_UP 32 + 2, // P1.02 SWITCH - 35, // P1.03 E22-SX1262 NSS 36, // P1.04 is not connected per schematic 37, // P1.05 is not connected per schematic 38, // P1.06 is not connected per schematic 39, // P1.07 is not connected per schematic - 32 + 8, // P1.08 E22-SX1262 BUSY 43, // P1.11 is not connected per schematic - 32 + 12, // P1.12 E22-SX1262 RESET 45, // P1.13 is not connected per schematic 46, // P1.14 is not connected per schematic }; diff --git a/variants/lora_relay_v1/variant.h b/variants/lora_relay_v1/variant.h index 06e59d02..fbf64c28 100644 --- a/variants/lora_relay_v1/variant.h +++ b/variants/lora_relay_v1/variant.h @@ -38,7 +38,7 @@ extern "C" { // Number of pins defined in PinDescription array #define PINS_COUNT (43) #define NUM_DIGITAL_PINS (43) -#define NUM_ANALOG_INPUTS (8) // A6 is used for battery, A7 is analog reference +#define NUM_ANALOG_INPUTS (7) // A6 is used for battery, A7 is analog reference #define NUM_ANALOG_OUTPUTS (0) // LEDs @@ -62,14 +62,13 @@ extern "C" { /* * Analog pins */ -#define PIN_A0 (14) -#define PIN_A1 (15) -#define PIN_A2 (16) -#define PIN_A3 (17) -#define PIN_A4 (18) -#define PIN_A5 (19) -#define PIN_A6 (20) -#define PIN_A7 (21) +#define PIN_A0 (15) +#define PIN_A1 (16) +#define PIN_A2 (17) +#define PIN_A3 (18) +#define PIN_A4 (19) +#define PIN_A5 (20) +#define PIN_A6 (21) static const uint8_t A0 = PIN_A0; static const uint8_t A1 = PIN_A1; @@ -78,12 +77,12 @@ static const uint8_t A3 = PIN_A3; static const uint8_t A4 = PIN_A4; static const uint8_t A5 = PIN_A5; static const uint8_t A6 = PIN_A6; -static const uint8_t A7 = PIN_A7; +// static const uint8_t A7 = PIN_A7; #define ADC_RESOLUTION 14 // Other pins -#define PIN_AREF PIN_A7 -#define PIN_VBAT PIN_A6 +#define PIN_AREF PIN_A6 +#define PIN_VBAT PIN_A5 #define PIN_NFC1 (33) #define PIN_NFC2 (2) @@ -117,17 +116,19 @@ static const uint8_t SCK = PIN_SPI_SCK; #define PIN_WIRE_SDA (22) #define PIN_WIRE_SCL (23) -// QSPI Pins -//#define PIN_QSPI_SCK 27 -//#define PIN_QSPI_CS 28 -//#define PIN_QSPI_IO0 29 -//#define PIN_QSPI_IO1 30 -//#define PIN_QSPI_IO2 31 -//#define PIN_QSPI_IO3 32 +// I2C device addresses +#define I2C_ADDR_BQ27441 0x55 // Battery gauge -// On-board QSPI Flash -//#define EXTERNAL_FLASH_DEVICES GD25Q16C -//#define EXTERNAL_FLASH_USE_QSPI +// CUSTOM GPIOs the SX1262 +#define SX1262_CS (32) +#define SX1262_DIO1 (29) +#define SX1262_DIO2 (30) +#define SX1262_BUSY (33) // Supposed to be P0.18 but because of reworks, now on P0.31 (18) +#define SX1262_RESET (34) +// #define SX1262_ANT_SW (32 + 10) +#define SX1262_RXEN (14) +#define SX1262_TXEN (31) +#define SX1262_E22 // Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that #ifdef __cplusplus } From 6b568ab2fb807e4da1a644ab727adc8b69a414ce Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 16 Aug 2020 14:50:04 -0700 Subject: [PATCH 05/15] add powerhold for @bigcorvus board --- platformio.ini | 3 ++- variants/lora_relay_v1/variant.cpp | 16 +++++++------- variants/lora_relay_v1/variant.h | 34 ++++++++++++++++++------------ 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/platformio.ini b/platformio.ini index 4a66d1bf..e98e7bb1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -218,7 +218,8 @@ extends = nrf52_base board = lora-relay-v1 lib_deps = ${env.lib_deps} - + SparkFun BQ27441 LiPo Fuel Gauge Arduino Library + # Adafruit ST7735 and ST7789 Library diff --git a/variants/lora_relay_v1/variant.cpp b/variants/lora_relay_v1/variant.cpp index dd275021..250101b7 100644 --- a/variants/lora_relay_v1/variant.cpp +++ b/variants/lora_relay_v1/variant.cpp @@ -40,15 +40,15 @@ const uint32_t g_ADigitalPinMap[] = { 8, // D12 is P0.08 D_CS (IPS display chip select) 41, // D13 is P1.09 BLT (IPS display backlight) 4, // D14 is P0.04 SX1262 RXEN + 5, // D15 is P0.05 PHOLD // D14 .. D21 (aka A0 .. A7) - 5, // D15 is P0.05 (A0) - 30, // D16 is P0.30 (A1) - 28, // D17 is P0.28 (A2) - 2, // D18 is P0.02 (A3) - 3, // D19 is P0.03 (A4) - 29, // D20 is P0.29 (A5, Battery) - 31, // D21 is P0.31 (A6, ARef) + 30, // D16 is P0.30 (A0) + 28, // D17 is P0.28 (A1) + 2, // D18 is P0.02 (A2) + 3, // D19 is P0.03 (A3) + 29, // D20 is P0.29 (A4, Battery) + 31, // D21 is P0.31 (A5, ARef) // D22 .. D23 (aka I2C pins) 12, // D22 is P0.12 (SDA) @@ -85,13 +85,13 @@ const uint32_t g_ADigitalPinMap[] = { 32 + 12, // D34 P1.12 E22-SX1262 RESET 32 + 1, // P1.01 BTN_UP 32 + 2, // P1.02 SWITCH + 32 + 14, // D37 P1.14 is not connected per schematic 36, // P1.04 is not connected per schematic 37, // P1.05 is not connected per schematic 38, // P1.06 is not connected per schematic 39, // P1.07 is not connected per schematic 43, // P1.11 is not connected per schematic 45, // P1.13 is not connected per schematic - 46, // P1.14 is not connected per schematic }; void initVariant() diff --git a/variants/lora_relay_v1/variant.h b/variants/lora_relay_v1/variant.h index fbf64c28..ddc46e68 100644 --- a/variants/lora_relay_v1/variant.h +++ b/variants/lora_relay_v1/variant.h @@ -38,7 +38,7 @@ extern "C" { // Number of pins defined in PinDescription array #define PINS_COUNT (43) #define NUM_DIGITAL_PINS (43) -#define NUM_ANALOG_INPUTS (7) // A6 is used for battery, A7 is analog reference +#define NUM_ANALOG_INPUTS (6) // A6 is used for battery, A7 is analog reference #define NUM_ANALOG_OUTPUTS (0) // LEDs @@ -62,13 +62,12 @@ extern "C" { /* * Analog pins */ -#define PIN_A0 (15) -#define PIN_A1 (16) -#define PIN_A2 (17) -#define PIN_A3 (18) -#define PIN_A4 (19) -#define PIN_A5 (20) -#define PIN_A6 (21) +#define PIN_A0 (16) +#define PIN_A1 (17) +#define PIN_A2 (18) +#define PIN_A3 (19) +#define PIN_A4 (20) +#define PIN_A5 (21) static const uint8_t A0 = PIN_A0; static const uint8_t A1 = PIN_A1; @@ -76,18 +75,27 @@ static const uint8_t A2 = PIN_A2; static const uint8_t A3 = PIN_A3; static const uint8_t A4 = PIN_A4; static const uint8_t A5 = PIN_A5; -static const uint8_t A6 = PIN_A6; -// static const uint8_t A7 = PIN_A7; #define ADC_RESOLUTION 14 // Other pins -#define PIN_AREF PIN_A6 -#define PIN_VBAT PIN_A5 +#define PIN_AREF PIN_A5 +#define PIN_VBAT PIN_A4 #define PIN_NFC1 (33) #define PIN_NFC2 (2) - +#define PIN_DISPLAY_RESET (11) // Output +#define PIN_PIEZO (37) +#define PIN_POWER_HOLD \ + (15) // FIXME, see warning hre https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay/blob/master/LORA_RELAY_NRF52840.ino static const uint8_t AREF = PIN_AREF; +/* +@geeksville +TODO FIXME +flash bootloader as if feather +power hold ST7735 +look at example sketch +*/ + /* * Serial interfaces */ From c0307cbcb009716e601ba3df52cf2a89ab80492b Mon Sep 17 00:00:00 2001 From: geeksville Date: Mon, 17 Aug 2020 10:23:21 -0700 Subject: [PATCH 06/15] a cleaner way to add variants - no longer need symlinks in adafruit proj --- platformio.ini | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platformio.ini b/platformio.ini index e98e7bb1..a53f411a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -186,6 +186,9 @@ board = nrf52840_dk [env:nrf52840dk-geeksville] extends = nrf52_base board = nrf52840_dk_modified +# add our variants files to the include and src paths +build_flags = ${nrf52_base.build_flags} -Ivariants/pca10056-rc-clock +src_filter = ${nrf52_base.src_filter} +<../variants/pca10056-rc-clock> ; Note: By default no lora device is created for this build - it uses a simulated interface [env:feather_nrf52832] @@ -216,6 +219,9 @@ lib_deps = [env:lora-relay-v1] extends = nrf52_base board = lora-relay-v1 +# add our variants files to the include and src paths +build_flags = ${nrf52_base.build_flags} -Ivariants/lora_relay_v1 +src_filter = ${nrf52_base.src_filter} +<../variants/lora_relay_v1> lib_deps = ${env.lib_deps} SparkFun BQ27441 LiPo Fuel Gauge Arduino Library From 22946b5e51084a35e848d0d0c7e9f5f85a035a1b Mon Sep 17 00:00:00 2001 From: geeksville Date: Mon, 17 Aug 2020 11:28:32 -0700 Subject: [PATCH 07/15] @BigCorvus board now kinda boots ###RTT Client: ----------------------------------------------- ###RTT Client: Connecting to J-Link RTT Server via localhost:19021 ... ###RTT Client: Connected. SEGGER J-Link V6.70c - Real time terminal output SEGGER J-Link ARM V9.6, SN=69663845 Process: JLinkGDBServerCLExe Emitting reboot packet for serial shell I2C device found at address 0x55 done Meshtastic swver=unset, hwver=unset Reset reason: 0x0 FIXME, call randomSeed ERROR: No UBLOX GPS found Hoping that NEMA might work RadioConfig reset! Initial packet id 1481765933, numPacketId 4294967295 No saved preferences found NODENUM=0xB18C3A4E, dbsize=1 Starting meshradio init... Set radio: name=Default, config=3, ch=6, power=17 SX1262 init result 0 sending owner !df5db18c3a4e/Unknown 3a4e/?4E Update DB node 0xB18C3A4E, rx_time=0 old user !df5db18c3a4e/Unknown 3a4e/?4E updating changed=0 user !df5db18c3a4e/Unknown 3a4e/?4E Adding packet record (id=0x5851F430 Fr0x4E To0xFF, WantAck0, HopLim3 Payload:User) enqueuing for send (id=0x5851F430 Fr0x4E To0xFF, WantAck0, HopLim3 encrypted) txGood=0,rxGood=0,rxBad=0 Starting low level send (id=0x5851F430 Fr0x4E To0xFF, WantAck0, HopLim3 encrypted) assert failed src/mesh/SX1262Interface.cpp: 102, virtual void SX1262Interface::setStandby(), test=err == ERR_NONE --- .gitignore | 2 + bin/uf2conv.py | 314 +++++++++++++++++++++++++++++++ bin/upload-to-bootloader.sh | 4 + boards/lora-relay-v1.json | 46 +++++ docs/hardware/corvus.md | 35 ++++ variants/lora_relay_v1/variant.h | 8 - 6 files changed, 401 insertions(+), 8 deletions(-) create mode 100755 bin/uf2conv.py create mode 100755 bin/upload-to-bootloader.sh create mode 100644 boards/lora-relay-v1.json create mode 100644 docs/hardware/corvus.md diff --git a/.gitignore b/.gitignore index c6d44fad..0ec49e6f 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ Thumbs.db .cproject .idea/* .vagrant + +flash.uf2 diff --git a/bin/uf2conv.py b/bin/uf2conv.py new file mode 100755 index 00000000..b619d14d --- /dev/null +++ b/bin/uf2conv.py @@ -0,0 +1,314 @@ +#!/usr/bin/env python3 +import sys +import struct +import subprocess +import re +import os +import os.path +import argparse + + +UF2_MAGIC_START0 = 0x0A324655 # "UF2\n" +UF2_MAGIC_START1 = 0x9E5D5157 # Randomly selected +UF2_MAGIC_END = 0x0AB16F30 # Ditto + +families = { + 'SAMD21': 0x68ed2b88, + 'SAML21': 0x1851780a, + 'SAMD51': 0x55114460, + 'NRF52': 0x1b57745f, + 'STM32F0': 0x647824b6, + 'STM32F1': 0x5ee21072, + 'STM32F2': 0x5d1a0a2e, + 'STM32F3': 0x6b846188, + 'STM32F4': 0x57755a57, + 'STM32F7': 0x53b80f00, + 'STM32G0': 0x300f5633, + 'STM32G4': 0x4c71240a, + 'STM32H7': 0x6db66082, + 'STM32L0': 0x202e3a91, + 'STM32L1': 0x1e1f432d, + 'STM32L4': 0x00ff6919, + 'STM32L5': 0x04240bdf, + 'STM32WB': 0x70d16653, + 'STM32WL': 0x21460ff0, + 'ATMEGA32': 0x16573617, + 'MIMXRT10XX': 0x4FB2D5BD +} + +INFO_FILE = "/INFO_UF2.TXT" + +appstartaddr = 0x2000 +familyid = 0x0 + + +def is_uf2(buf): + w = struct.unpack(" 476: + assert False, "Invalid UF2 data size at " + ptr + newaddr = hd[3] + if curraddr == None: + appstartaddr = newaddr + curraddr = newaddr + padding = newaddr - curraddr + if padding < 0: + assert False, "Block out of order at " + ptr + if padding > 10*1024*1024: + assert False, "More than 10M of padding needed at " + ptr + if padding % 4 != 0: + assert False, "Non-word padding size at " + ptr + while padding > 0: + padding -= 4 + outp += b"\x00\x00\x00\x00" + outp += block[32 : 32 + datalen] + curraddr = newaddr + datalen + return outp + +def convert_to_carray(file_content): + outp = "const unsigned char bindata[] __attribute__((aligned(16))) = {" + for i in range(len(file_content)): + if i % 16 == 0: + outp += "\n" + outp += "0x%02x, " % ord(file_content[i]) + outp += "\n};\n" + return outp + +def convert_to_uf2(file_content): + global familyid + datapadding = b"" + while len(datapadding) < 512 - 256 - 32 - 4: + datapadding += b"\x00\x00\x00\x00" + numblocks = (len(file_content) + 255) // 256 + outp = b"" + for blockno in range(numblocks): + ptr = 256 * blockno + chunk = file_content[ptr:ptr + 256] + flags = 0x0 + if familyid: + flags |= 0x2000 + hd = struct.pack(b"= 3 and words[1] == "2" and words[2] == "FAT": + drives.append(words[0]) + else: + rootpath = "/media" + if sys.platform == "darwin": + rootpath = "/Volumes" + elif sys.platform == "linux": + tmp = rootpath + "/" + os.environ["USER"] + if os.path.isdir(tmp): + rootpath = tmp + for d in os.listdir(rootpath): + drives.append(os.path.join(rootpath, d)) + + + def has_info(d): + try: + return os.path.isfile(d + INFO_FILE) + except: + return False + + return list(filter(has_info, drives)) + + +def board_id(path): + with open(path + INFO_FILE, mode='r') as file: + file_content = file.read() + return re.search("Board-ID: ([^\r\n]*)", file_content).group(1) + + +def list_drives(): + for d in get_drives(): + print(d, board_id(d)) + + +def write_file(name, buf): + with open(name, "wb") as f: + f.write(buf) + print("Wrote %d bytes to %s" % (len(buf), name)) + + +def main(): + global appstartaddr, familyid + def error(msg): + print(msg) + sys.exit(1) + parser = argparse.ArgumentParser(description='Convert to UF2 or flash directly.') + parser.add_argument('input', metavar='INPUT', type=str, nargs='?', + help='input file (HEX, BIN or UF2)') + parser.add_argument('-b' , '--base', dest='base', type=str, + default="0x2000", + help='set base address of application for BIN format (default: 0x2000)') + parser.add_argument('-o' , '--output', metavar="FILE", dest='output', type=str, + help='write output to named file; defaults to "flash.uf2" or "flash.bin" where sensible') + parser.add_argument('-d' , '--device', dest="device_path", + help='select a device path to flash') + parser.add_argument('-l' , '--list', action='store_true', + help='list connected devices') + parser.add_argument('-c' , '--convert', action='store_true', + help='do not flash, just convert') + parser.add_argument('-D' , '--deploy', action='store_true', + help='just flash, do not convert') + parser.add_argument('-f' , '--family', dest='family', type=str, + default="0x0", + help='specify familyID - number or name (default: 0x0)') + parser.add_argument('-C' , '--carray', action='store_true', + help='convert binary file to a C array, not UF2') + args = parser.parse_args() + appstartaddr = int(args.base, 0) + + if args.family.upper() in families: + familyid = families[args.family.upper()] + else: + try: + familyid = int(args.family, 0) + except ValueError: + error("Family ID needs to be a number or one of: " + ", ".join(families.keys())) + + if args.list: + list_drives() + else: + if not args.input: + error("Need input file") + with open(args.input, mode='rb') as f: + inpbuf = f.read() + from_uf2 = is_uf2(inpbuf) + ext = "uf2" + if args.deploy: + outbuf = inpbuf + elif from_uf2: + outbuf = convert_from_uf2(inpbuf) + ext = "bin" + elif is_hex(inpbuf): + outbuf = convert_from_hex_to_uf2(inpbuf.decode("utf-8")) + elif args.carray: + outbuf = convert_to_carray(inpbuf) + ext = "h" + else: + outbuf = convert_to_uf2(inpbuf) + print("Converting to %s, output size: %d, start address: 0x%x" % + (ext, len(outbuf), appstartaddr)) + if args.convert or ext != "uf2": + drives = [] + if args.output == None: + args.output = "flash." + ext + else: + drives = get_drives() + + if args.output: + write_file(args.output, outbuf) + else: + if len(drives) == 0: + error("No drive to deploy.") + for d in drives: + print("Flashing %s (%s)" % (d, board_id(d))) + write_file(d + "/NEW.UF2", outbuf) + + +if __name__ == "__main__": + main() diff --git a/bin/upload-to-bootloader.sh b/bin/upload-to-bootloader.sh new file mode 100755 index 00000000..edaee75c --- /dev/null +++ b/bin/upload-to-bootloader.sh @@ -0,0 +1,4 @@ + +echo "Converting to uf2 for NRF52 Adafruit bootloader" +bin/uf2conv.py .pio/build/lora-relay-v1/firmware.hex -c -f 0xADA52840 +cp flash.uf2 /media/kevinh/FTH*BOOT/ diff --git a/boards/lora-relay-v1.json b/boards/lora-relay-v1.json new file mode 100644 index 00000000..ca4e2f0a --- /dev/null +++ b/boards/lora-relay-v1.json @@ -0,0 +1,46 @@ +{ + "build": { + "arduino": { + "ldscript": "nrf52840_s140_v6.ld" + }, + "core": "nRF5", + "cpu": "cortex-m4", + "extra_flags": "-DARDUINO_NRF52840_LORA_RELAY_V1 -DNRF52840_XXAA", + "f_cpu": "64000000L", + "hwids": [["0x239A", "0x4404"]], + "usb_product": "LORA_RELAY", + "mcu": "nrf52840", + "variant": "lora_relay_v1", + "variants_dir": "variants", + "bsp": { + "name": "adafruit" + }, + "softdevice": { + "sd_flags": "-DS140", + "sd_name": "s140", + "sd_version": "6.1.1", + "sd_fwid": "0x00B6" + }, + "bootloader": { + "settings_addr": "0xFF000" + } + }, + "connectivity": ["bluetooth"], + "debug": { + "jlink_device": "nRF52840_xxAA", + "onboard_tools": ["jlink"], + "svd_path": "nrf52840.svd" + }, + "frameworks": ["arduino"], + "name": "Meshtastic Lora Relay V1 (Adafruit BSP)", + "upload": { + "maximum_ram_size": 248832, + "maximum_size": 815104, + "require_upload_port": true, + "speed": 115200, + "protocol": "jlink", + "protocols": ["jlink", "nrfjprog", "stlink"] + }, + "url": "https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay", + "vendor": "BigCorvus" +} diff --git a/docs/hardware/corvus.md b/docs/hardware/corvus.md new file mode 100644 index 00000000..f1089f3a --- /dev/null +++ b/docs/hardware/corvus.md @@ -0,0 +1,35 @@ +# Notes on @BigCorvus boards + +## Board version 1.1 + +variant name lora_relay_v1 + +### Remaining TODOs + +- power hold for the ST7735 +- look at example sketch +- turn on xmit boost + +## Recommendations for future boards + +@BigCorvus your board is **really** nice. Here's some ideas for the future: + +- make the SWDIO header more standard (the small ARM 2x5 micro footprint?) or at least througholes so it is easy to solder a header + +## How to program bootloader + +Download from here: https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases + +``` +nrfjprog -f nrf52 --eraseall +Erasing user available code and UICR flash areas. +Applying system reset. + +nrfjprog -f nrf52 --program feather_nrf52840_express_bootloader-0.3.2_s140_6.1.1.hex +Parsing hex file. +Reading flash area to program to guarantee it is erased. +Checking that the area to write is not protected. +Programming device. +``` + +Then reboot the board, if all went well it now shows up as a mountable filesystem on your USB bus. diff --git a/variants/lora_relay_v1/variant.h b/variants/lora_relay_v1/variant.h index ddc46e68..7d2dcaf1 100644 --- a/variants/lora_relay_v1/variant.h +++ b/variants/lora_relay_v1/variant.h @@ -88,14 +88,6 @@ static const uint8_t A5 = PIN_A5; (15) // FIXME, see warning hre https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay/blob/master/LORA_RELAY_NRF52840.ino static const uint8_t AREF = PIN_AREF; -/* -@geeksville -TODO FIXME -flash bootloader as if feather -power hold ST7735 -look at example sketch -*/ - /* * Serial interfaces */ From 781077e799f84000797f1951e0a36c093e9c2fe4 Mon Sep 17 00:00:00 2001 From: geeksville Date: Mon, 17 Aug 2020 11:42:19 -0700 Subject: [PATCH 08/15] Turn on buck converter for @BigCorvus board, now radio works --- src/mesh/SX1262Interface.cpp | 5 +++++ variants/lora_relay_v1/variant.cpp | 2 +- variants/lora_relay_v1/variant.h | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mesh/SX1262Interface.cpp b/src/mesh/SX1262Interface.cpp index 8edb7294..6350741e 100644 --- a/src/mesh/SX1262Interface.cpp +++ b/src/mesh/SX1262Interface.cpp @@ -12,6 +12,11 @@ SX1262Interface::SX1262Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RA /// \return true if initialisation succeeded. bool SX1262Interface::init() { +#ifdef SX1262_POWER_EN + digitalWrite(SX1262_POWER_EN, HIGH); + pinMode(SX1262_POWER_EN, OUTPUT); +#endif + RadioLibInterface::init(); #ifdef SX1262_RXEN // set not rx or tx mode diff --git a/variants/lora_relay_v1/variant.cpp b/variants/lora_relay_v1/variant.cpp index 250101b7..58652a5c 100644 --- a/variants/lora_relay_v1/variant.cpp +++ b/variants/lora_relay_v1/variant.cpp @@ -40,7 +40,7 @@ const uint32_t g_ADigitalPinMap[] = { 8, // D12 is P0.08 D_CS (IPS display chip select) 41, // D13 is P1.09 BLT (IPS display backlight) 4, // D14 is P0.04 SX1262 RXEN - 5, // D15 is P0.05 PHOLD + 5, // D15 is P0.05 BOOST_EN (5V buck converter enable for the the radio power) // D14 .. D21 (aka A0 .. A7) 30, // D16 is P0.30 (A0) diff --git a/variants/lora_relay_v1/variant.h b/variants/lora_relay_v1/variant.h index 7d2dcaf1..44e14eb4 100644 --- a/variants/lora_relay_v1/variant.h +++ b/variants/lora_relay_v1/variant.h @@ -84,8 +84,6 @@ static const uint8_t A5 = PIN_A5; #define PIN_NFC2 (2) #define PIN_DISPLAY_RESET (11) // Output #define PIN_PIEZO (37) -#define PIN_POWER_HOLD \ - (15) // FIXME, see warning hre https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay/blob/master/LORA_RELAY_NRF52840.ino static const uint8_t AREF = PIN_AREF; /* @@ -128,6 +126,8 @@ static const uint8_t SCK = PIN_SPI_SCK; // #define SX1262_ANT_SW (32 + 10) #define SX1262_RXEN (14) #define SX1262_TXEN (31) +#define SX1262_POWER_EN \ + (15) // FIXME, see warning hre https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay/blob/master/LORA_RELAY_NRF52840.ino #define SX1262_E22 // Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that #ifdef __cplusplus From 3c09c3e52021cce6526577aa173a9edfb548a695 Mon Sep 17 00:00:00 2001 From: geeksville Date: Mon, 17 Aug 2020 11:50:50 -0700 Subject: [PATCH 09/15] show NRF52840 debug output via the USB CDC-ACM device --- src/configuration.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index 42b9ff05..d23a42f8 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -339,8 +339,9 @@ along with this program. If not, see . // Debug printing to segger console #define SEGGER_MSG(...) SEGGER_RTT_printf(0, __VA_ARGS__) -// nrf52 gets its settings via variant files -#ifndef PIN_SERIAL_RX +// If we are not on a NRF52840 (which has built in USB-ACM serial support) and we don't have serial pins hooked up, then we MUST +// use SEGGER for debug output +#if !defined(PIN_SERIAL_RX) && !defined(NRF52840_XXAA) // No serial ports on this board - ONLY use segger in memory console #define USE_SEGGER #endif From 66557241f3282c7ef2a532e7a6e7ca7e6c1f8e81 Mon Sep 17 00:00:00 2001 From: geeksville Date: Mon, 17 Aug 2020 12:29:45 -0700 Subject: [PATCH 10/15] Generate UF2 files for NRF52 release builds --- bin/build-all.sh | 31 ++++++++++++++++++++++--------- bin/upload-to-bootloader.sh | 4 ++-- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/bin/build-all.sh b/bin/build-all.sh index 3f32d228..5a860bc4 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -8,7 +8,11 @@ COUNTRIES="US EU433 EU865 CN JP" #COUNTRIES=US #COUNTRIES=CN -BOARDS="tlora-v2 tlora-v1 tlora-v2-1-1.6 tbeam heltec tbeam0.7" +BOARDS_ESP32="tlora-v2 tlora-v1 tlora-v2-1-1.6 tbeam heltec tbeam0.7" + +# FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine +BOARDS_NRF52="lora-relay-v1" +BOARDS="$BOARDS_ESP32 $BOARDS_NRF52" #BOARDS=tbeam OUTDIR=release/latest @@ -23,20 +27,17 @@ rm -f $OUTDIR/bins/* # build the named environment and copy the bins to the release directory function do_build { - ENV_NAME=$1 - echo "Building for $ENV_NAME with $PLATFORMIO_BUILD_FLAGS" - SRCBIN=.pio/build/$ENV_NAME/firmware.bin - SRCELF=.pio/build/$ENV_NAME/firmware.elf - rm -f $SRCBIN + echo "Building for $BOARD with $PLATFORMIO_BUILD_FLAGS" + rm -f .pio/build/$BOARD/firmware.* # The shell vars the build tool expects to find export HW_VERSION="1.0-$COUNTRY" export APP_VERSION=$VERSION export COUNTRY - pio run --jobs 4 --environment $ENV_NAME # -v - cp $SRCBIN $OUTDIR/bins/firmware-$ENV_NAME-$COUNTRY-$VERSION.bin - cp $SRCELF $OUTDIR/elfs/firmware-$ENV_NAME-$COUNTRY-$VERSION.elf + pio run --jobs 4 --environment $BOARD # -v + SRCELF=.pio/build/$BOARD/firmware.elf + cp $SRCELF $OUTDIR/elfs/firmware-$BOARD-$COUNTRY-$VERSION.elf } # Make sure our submodules are current @@ -49,6 +50,18 @@ for COUNTRY in $COUNTRIES; do for BOARD in $BOARDS; do do_build $BOARD done + + echo "Copying ESP32 bin files" + for BOARD in $BOARDS_ESP32; do + SRCBIN=.pio/build/$BOARD/firmware.bin + cp $SRCBIN $OUTDIR/bins/firmware-$BOARD-$COUNTRY-$VERSION.bin + done + + echo "Generating NRF52 uf2 files" + for BOARD in $BOARDS_NRF52; do + SRCHEX=.pio/build/$BOARD/firmware.hex + bin/uf2conv.py $SRCHEX -c -o $OUTDIR/bins/firmware-$BOARD-$COUNTRY-$VERSION.uf2 -f 0xADA52840 + done done # keep the bins in archive also diff --git a/bin/upload-to-bootloader.sh b/bin/upload-to-bootloader.sh index edaee75c..55a039a6 100755 --- a/bin/upload-to-bootloader.sh +++ b/bin/upload-to-bootloader.sh @@ -1,4 +1,4 @@ echo "Converting to uf2 for NRF52 Adafruit bootloader" -bin/uf2conv.py .pio/build/lora-relay-v1/firmware.hex -c -f 0xADA52840 -cp flash.uf2 /media/kevinh/FTH*BOOT/ +bin/uf2conv.py .pio/build/lora-relay-v1/firmware.hex -f 0xADA52840 +# cp flash.uf2 /media/kevinh/FTH*BOOT/ From e3b74ece74fb46a4c0bb35e3ee0168a11c30ab1e Mon Sep 17 00:00:00 2001 From: geeksville Date: Mon, 17 Aug 2020 12:38:53 -0700 Subject: [PATCH 11/15] use the lora-relay board for CI builds --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b23a3545..8031b8da 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,4 +23,4 @@ jobs: run: | pip install -U adafruit-nrfutil - name: Build - run: platformio run -e tbeam -e heltec -e nrf52840dk -e rak815 + run: platformio run -e tbeam -e heltec -e lora-relay-v1 From d91ab5480f80cf91b08f32715b890404873a65ff Mon Sep 17 00:00:00 2001 From: geeksville Date: Mon, 17 Aug 2020 13:47:05 -0700 Subject: [PATCH 12/15] begin support for TFT displays --- platformio.ini | 1 + src/User_Setup.h | 339 +++++++++++++++++++++++++++++ src/graphics/TFT.cpp | 17 ++ src/graphics/TFT.h | 3 + src/nrf52/main-nrf52.cpp | 6 + variants/lora_relay_v1/variant.cpp | 2 +- variants/lora_relay_v1/variant.h | 6 +- 7 files changed, 372 insertions(+), 2 deletions(-) create mode 100644 src/User_Setup.h create mode 100644 src/graphics/TFT.cpp create mode 100644 src/graphics/TFT.h diff --git a/platformio.ini b/platformio.ini index a53f411a..8970eee8 100644 --- a/platformio.ini +++ b/platformio.ini @@ -225,6 +225,7 @@ src_filter = ${nrf52_base.src_filter} +<../variants/lora_relay_v1> lib_deps = ${env.lib_deps} SparkFun BQ27441 LiPo Fuel Gauge Arduino Library + TFT_eSPI # Adafruit ST7735 and ST7789 Library diff --git a/src/User_Setup.h b/src/User_Setup.h new file mode 100644 index 00000000..d1aef836 --- /dev/null +++ b/src/User_Setup.h @@ -0,0 +1,339 @@ +// This file is used to set TFT/eInk preferences for the TFT.cpp driver + +#include + +// USER DEFINED SETTINGS +// Set driver type, fonts to be loaded, pins used and SPI control method etc +// +// See the User_Setup_Select.h file if you wish to be able to define multiple +// setups and then easily select which setup file is used by the compiler. +// +// If this file is edited correctly then all the library example sketches should +// run without the need to make any more changes for a particular hardware setup! +// Note that some sketches are designed for a particular TFT pixel width/height + + +// ################################################################################## +// +// Section 1. Call up the right driver file and any options for it +// +// ################################################################################## + +// Define STM32 to invoke optimised processor support (only for STM32) +//#define STM32 + +// Defining the STM32 board allows the library to optimise the performance +// for UNO compatible "MCUfriend" style shields +//#define NUCLEO_64_TFT +//#define NUCLEO_144_TFT + +// STM32 8 bit parallel only: +// If STN32 Port A or B pins 0-7 are used for 8 bit parallel data bus bits 0-7 +// then this will improve rendering performance by a factor of ~8x +//#define STM_PORTA_DATA_BUS +//#define STM_PORTA_DATA_BUS + +// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed) +//#define TFT_PARALLEL_8_BIT + +// Display type - only define if RPi display +//#define RPI_DISPLAY_TYPE // 20MHz maximum SPI + +// Only define one driver, the other ones must be commented out +//#define ILI9341_DRIVER +#define ST7735_DRIVER // Define additional parameters below for this display +//#define ILI9163_DRIVER // Define additional parameters below for this display +//#define S6D02A1_DRIVER +//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI +//#define HX8357D_DRIVER +//#define ILI9481_DRIVER +//#define ILI9486_DRIVER +//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high) +//#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display +//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display +//#define R61581_DRIVER +//#define RM68140_DRIVER +//#define ST7796_DRIVER +//#define SSD1963_480_DRIVER // Untested +//#define SSD1963_800_DRIVER // Untested +//#define SSD1963_800ALT_DRIVER // Untested + +// Some displays support SPI reads via the MISO pin, other displays have a single +// bi-directional SDA pin and the library will try to read this via the MOSI line. +// To use the SDA line for reading data from the TFT uncomment the following line: + +// #define TFT_SDA_READ // This option is for ESP32 ONLY, tested with ST7789 display only + +// For ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display +// Try ONE option at a time to find the correct colour order for your display + +// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue +// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red + +// For M5Stack ESP32 module with integrated ILI9341 display ONLY, remove // in line below + +// #define M5STACK + +// For ST7789, ST7735 and ILI9163 ONLY, define the pixel width and height in portrait orientation +#define TFT_WIDTH 80 +// #define TFT_WIDTH 128 +// #define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320 +#define TFT_HEIGHT 160 +// #define TFT_HEIGHT 128 +// #define TFT_HEIGHT 240 // ST7789 240 x 240 +// #define TFT_HEIGHT 320 // ST7789 240 x 320 + +// For ST7735 ONLY, define the type of display, originally this was based on the +// colour of the tab on the screen protector film but this is not always true, so try +// out the different options below if the screen does not display graphics correctly, +// e.g. colours wrong, mirror images, or tray pixels at the edges. +// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this +// this User_Setup file, then rebuild and upload the sketch to the board again: + +// #define ST7735_INITB +#define ST7735_GREENTAB +// #define ST7735_GREENTAB2 +// #define ST7735_GREENTAB3 +// #define ST7735_GREENTAB128 // For 128 x 128 display +// #define ST7735_GREENTAB160x80 // For 160 x 80 display (BGR, inverted, 26 offset) +// #define ST7735_REDTAB +// #define ST7735_BLACKTAB +// #define ST7735_REDTAB160x80 // For 160 x 80 display with 24 pixel offset + +// If colours are inverted (white shows as black) then uncomment one of the next +// 2 lines try both options, one of the options should correct the inversion. + +// #define TFT_INVERSION_ON +// #define TFT_INVERSION_OFF + + +// ################################################################################## +// +// Section 2. Define the pins that are used to interface with the display here +// +// ################################################################################## + +// If a backlight control signal is available then define the TFT_BL pin in Section 2 +// below. The backlight will be turned ON when tft.begin() is called, but the library +// needs to know if the LEDs are ON with the pin HIGH or LOW. If the LEDs are to be +// driven with a PWM signal or turned OFF/ON then this must be handled by the user +// sketch. e.g. with digitalWrite(TFT_BL, LOW); + +#define TFT_BL ST7735_BACKLIGHT_EN // LED back-light control pin +#define TFT_BACKLIGHT_ON HIGH // Level to turn ON back-light (HIGH or LOW) + + + +// We must use hardware SPI, a minimum of 3 GPIO pins is needed. +// Typical setup for ESP8266 NodeMCU ESP-12 is : +// +// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT) +// Display LED to NodeMCU pin VIN (or 5V, see below) +// Display SCK to NodeMCU pin D5 +// Display SDI/MOSI to NodeMCU pin D7 +// Display DC (RS/AO)to NodeMCU pin D3 +// Display RESET to NodeMCU pin D4 (or RST, see below) +// Display CS to NodeMCU pin D8 (or GND, see below) +// Display GND to NodeMCU pin GND (0V) +// Display VCC to NodeMCU 5V or 3.3V +// +// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin +// +// The DC (Data Command) pin may be labeled AO or RS (Register Select) +// +// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more +// SPI devices (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS +// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin +// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected. +// +// The NodeMCU D0 pin can be used for RST +// +// +// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin +// If 5V is not available at a pin you can use 3.3V but backlight brightness +// will be lower. + + +// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ###### + +// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation +#define TFT_CS ST7735_CS // Chip select control pin D8 +#define TFT_DC ST7735_RS // Data Command control pin +#define TFT_RST ST7735_RESET // Reset pin (could connect to NodeMCU RST, see next line) +//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V + +//#define TFT_BL PIN_D1 // LED back-light (only for ST7789 with backlight control pin) + +//#define TOUCH_CS PIN_D2 // Chip select pin (T_CS) of touch screen + +//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only + + +// ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ###### + +// Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact +// but saves pins for other functions. It is best not to connect MISO as some displays +// do not tristate that line wjen chip select is high! +// On NodeMCU 1.0 SD0=MISO, SD1=MOSI, CLK=SCLK to connect to TFT in overlap mode +// On NodeMCU V3 S0 =MISO, S1 =MOSI, S2 =SCLK +// In ESP8266 overlap mode the following must be defined + +//#define TFT_SPI_OVERLAP + +// In ESP8266 overlap mode the TFT chip select MUST connect to pin D3 +//#define TFT_CS PIN_D3 +//#define TFT_DC PIN_D5 // Data Command control pin +//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line) +//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V + + +// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###### + +// For ESP32 Dev board (only tested with ILI9341 display) +// The hardware SPI can be mapped to any pins + +//#define TFT_MISO 19 +//#define TFT_MOSI 23 +//#define TFT_SCLK 18 +//#define TFT_CS 15 // Chip select control pin +//#define TFT_DC 2 // Data Command control pin +//#define TFT_RST 4 // Reset pin (could connect to RST pin) +//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST + +//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen + +//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only + +// For the M5Stack module use these #define lines +//#define TFT_MISO 19 +//#define TFT_MOSI 23 +//#define TFT_SCLK 18 +//#define TFT_CS 14 // Chip select control pin +//#define TFT_DC 27 // Data Command control pin +//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin) +//#define TFT_BL 32 // LED back-light (required for M5Stack) + +// ###### EDIT THE PINs BELOW TO SUIT YOUR ESP32 PARALLEL TFT SETUP ###### + +// The library supports 8 bit parallel TFTs with the ESP32, the pin +// selection below is compatible with ESP32 boards in UNO format. +// Wemos D32 boards need to be modified, see diagram in Tools folder. +// Only ILI9481 and ILI9341 based displays have been tested! + +// Parallel bus is only supported for the STM32 and ESP32 +// Example below is for ESP32 Parallel interface with UNO displays + +// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed) +//#define TFT_PARALLEL_8_BIT + +// The ESP32 and TFT the pins used for testing are: +//#define TFT_CS 33 // Chip select control pin (library pulls permanently low +//#define TFT_DC 15 // Data Command control pin - must use a pin in the range 0-31 +//#define TFT_RST 32 // Reset pin, toggles on startup + +//#define TFT_WR 4 // Write strobe control pin - must use a pin in the range 0-31 +//#define TFT_RD 2 // Read strobe control pin + +//#define TFT_D0 12 // Must use pins in the range 0-31 for the data bus +//#define TFT_D1 13 // so a single register write sets/clears all bits. +//#define TFT_D2 26 // Pins can be randomly assigned, this does not affect +//#define TFT_D3 25 // TFT screen update performance. +//#define TFT_D4 17 +//#define TFT_D5 16 +//#define TFT_D6 27 +//#define TFT_D7 14 + +// ###### EDIT THE PINs BELOW TO SUIT YOUR STM32 SPI TFT SETUP ###### + +// The TFT can be connected to SPI port 1 or 2 +//#define TFT_SPI_PORT 1 // SPI port 1 maximum clock rate is 55MHz +//#define TFT_MOSI PA7 +//#define TFT_MISO PA6 +//#define TFT_SCLK PA5 + +//#define TFT_SPI_PORT 2 // SPI port 2 maximum clock rate is 27MHz +//#define TFT_MOSI PB15 +//#define TFT_MISO PB14 +//#define TFT_SCLK PB13 + +// Can use Ardiuno pin references, arbitrary allocation, TFT_eSPI controls chip select +//#define TFT_CS D5 // Chip select control pin to TFT CS +//#define TFT_DC D6 // Data Command control pin to TFT DC (may be labelled RS = Register Select) +//#define TFT_RST D7 // Reset pin to TFT RST (or RESET) +// OR alternatively, we can use STM32 port reference names PXnn +//#define TFT_CS PE11 // Nucleo-F767ZI equivalent of D5 +//#define TFT_DC PE9 // Nucleo-F767ZI equivalent of D6 +//#define TFT_RST PF13 // Nucleo-F767ZI equivalent of D7 + +//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to processor reset + // Use an Arduino pin for initial testing as connecting to processor reset + // may not work (pulse too short at power up?) + +// ################################################################################## +// +// Section 3. Define the fonts that are to be used here +// +// ################################################################################## + +// Comment out the #defines below with // to stop that font being loaded +// The ESP8366 and ESP32 have plenty of memory so commenting out fonts is not +// normally necessary. If all fonts are loaded the extra FLASH space required is +// about 17Kbytes. To save FLASH space only enable the fonts you need! + +//#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH +//#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters +//#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters +//#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm +//#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-. +//#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-. +//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT +//#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts + +// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded +// this will save ~20kbytes of FLASH +//#define SMOOTH_FONT + + +// ################################################################################## +// +// Section 4. Other options +// +// ################################################################################## + +// Define the SPI clock frequency, this affects the graphics rendering speed. Too +// fast and the TFT driver will not keep up and display corruption appears. +// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails +// With a ST7735 display more than 27MHz may not work (spurious pixels and lines) +// With an ILI9163 display 27 MHz works OK. + +// #define SPI_FREQUENCY 1000000 +// #define SPI_FREQUENCY 5000000 +// #define SPI_FREQUENCY 10000000 +// #define SPI_FREQUENCY 20000000 +#define SPI_FREQUENCY 27000000 +// #define SPI_FREQUENCY 40000000 +// #define SPI_FREQUENCY 55000000 // STM32 SPI1 only (SPI2 maximum is 27MHz) +// #define SPI_FREQUENCY 80000000 + +// Optional reduced SPI frequency for reading TFT +#define SPI_READ_FREQUENCY 20000000 + +// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here: +#define SPI_TOUCH_FREQUENCY 2500000 + +// The ESP32 has 2 free SPI ports i.e. VSPI and HSPI, the VSPI is the default. +// If the VSPI port is in use and pins are not accessible (e.g. TTGO T-Beam) +// then uncomment the following line: +//#define USE_HSPI_PORT + +// Comment out the following #define if "SPI Transactions" do not need to be +// supported. When commented out the code size will be smaller and sketches will +// run slightly faster, so leave it commented out unless you need it! + +// Transaction support is needed to work with SD library but not needed with TFT_SdFat +// Transaction support is required if other SPI devices are connected. + +// Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex) +// so changing it here has no effect + +// #define SUPPORT_TRANSACTIONS diff --git a/src/graphics/TFT.cpp b/src/graphics/TFT.cpp new file mode 100644 index 00000000..3d9ea46e --- /dev/null +++ b/src/graphics/TFT.cpp @@ -0,0 +1,17 @@ +#include "configuration.h" + +#include +#include // Graphics and font library for ST7735 driver chip + +#ifdef ST7735_CS + +TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in User_Setup.h + +void TFTinit() +{ + tft.init(); + tft.setRotation(1); + tft.fillScreen(TFT_BLUE); +} + +#endif diff --git a/src/graphics/TFT.h b/src/graphics/TFT.h new file mode 100644 index 00000000..75279375 --- /dev/null +++ b/src/graphics/TFT.h @@ -0,0 +1,3 @@ +#pragma once + +void TFTinit(); diff --git a/src/nrf52/main-nrf52.cpp b/src/nrf52/main-nrf52.cpp index 08d2baf0..a537c826 100644 --- a/src/nrf52/main-nrf52.cpp +++ b/src/nrf52/main-nrf52.cpp @@ -1,5 +1,6 @@ #include "NRF52Bluetooth.h" #include "configuration.h" +#include "graphics/TFT.h" #include #include #include @@ -98,4 +99,9 @@ void nrf52Setup() // randomSeed(r); DEBUG_MSG("FIXME, call randomSeed\n"); // ::printf("TESTING PRINTF\n"); + +// Setup TFT display - FIXME do somewhere else +#ifdef ST7735_CS + TFTinit(); +#endif } \ No newline at end of file diff --git a/variants/lora_relay_v1/variant.cpp b/variants/lora_relay_v1/variant.cpp index 58652a5c..891c8bb2 100644 --- a/variants/lora_relay_v1/variant.cpp +++ b/variants/lora_relay_v1/variant.cpp @@ -34,7 +34,7 @@ const uint32_t g_ADigitalPinMap[] = { 7, // D6 is P0.07 34, // D7 is P1.02 (Button) 16, // D8 is P0.16 (NeoPixel) - 26, // D9 is P0.26 + 26, // D9 is P0.26 D_RS (IPS data/command control) 27, // D10 is P0.27 6, // D11 is P0.06 D_RES (IPS display reset) 8, // D12 is P0.08 D_CS (IPS display chip select) diff --git a/variants/lora_relay_v1/variant.h b/variants/lora_relay_v1/variant.h index 44e14eb4..0f4ac488 100644 --- a/variants/lora_relay_v1/variant.h +++ b/variants/lora_relay_v1/variant.h @@ -82,7 +82,6 @@ static const uint8_t A5 = PIN_A5; #define PIN_VBAT PIN_A4 #define PIN_NFC1 (33) #define PIN_NFC2 (2) -#define PIN_DISPLAY_RESET (11) // Output #define PIN_PIEZO (37) static const uint8_t AREF = PIN_AREF; @@ -130,6 +129,11 @@ static const uint8_t SCK = PIN_SPI_SCK; (15) // FIXME, see warning hre https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay/blob/master/LORA_RELAY_NRF52840.ino #define SX1262_E22 // Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that +#define ST7735_RESET (11) // Output +#define ST7735_CS (12) +#define ST7735_BACKLIGHT_EN (13) +#define ST7735_RS (9) + #ifdef __cplusplus } #endif From 285069703cb39ad12222a8751378d96e30fcf38e Mon Sep 17 00:00:00 2001 From: geeksville Date: Mon, 17 Aug 2020 14:01:03 -0700 Subject: [PATCH 13/15] add missing button --- images/amazon-fire-button.png | Bin 0 -> 12634 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 images/amazon-fire-button.png diff --git a/images/amazon-fire-button.png b/images/amazon-fire-button.png new file mode 100644 index 0000000000000000000000000000000000000000..b60cb61bc9f26d4c8d4a7589cdab94c187a29f95 GIT binary patch literal 12634 zcmYLw1yGyM^EV|Fin|1NFVIjRxND0QD^}bsSc}u(h2X`#v_Nqy1P^WninTbwt+@M} zet+|ycV{wBE_2V_?%v++=XNijv^13Qaj0?7(9rNzRTSQ!p`k-i-_@UCqM<#}c5`q; zHJ*6BQINsb1mvAh6=e^2R&UCV&Hv3mT z+}z&$`H-BHL{dZ~k%{EU9KAw#ZjCBG4G#~$A#|Exb%e04toL+d88xXUvxn#Sczl^{ zisD#MW(e$wqn8}guQ2M>$d&l+Pt~MGCFy^$?tY{(k|na$ ze-#-lgKcoEPpP9I)^8|@6=fY)=dYpQX;PNeS2yMvYIxK=^}d z!mR@TqQ z;WR%CIaP3g%5SLE9m9c|3meaZShzIhilUj_4hdk4OQL~iJM7lh5$iz`QcQViV}q4e z+kEO|#0!Hw zh>r%R=;*FLnkaE?1gkHpygvbvS6ATiS!_{MeQcKJrFYTTCk(cNt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+8B5Nen zrF@r*A9|1KzpAOfd#2*rsS~A%Zuc`1mwsnokaT*KDPU@C^6dfce(2EQR~}o7Vtu>~ ziz`C?_%3!xQqWfux4^2u{YfZ;#YO*M_vKgNq9$v`yZM_;b}>o6^MgIIm1r#V#vnE7 z+lSuwMKh0o^JXV639RYFVo3x8wQ$kj`CO1U*k8$9qV3l*YTxSPE+q2i z1kEG?xaccMF$flQ&i%A&15?k>{V8v^wP)w-z(Cf|e+_y6y%s*h0@1%F76U!5yeoIR zEC~6jp4FDIH!jV7A2UKPn!RUKzN1~Nzd{T)lz!tpV1B`(igIjEp?is(XUzWgNgL-C zSt1r&598X!%2C024HvXgEFafIZW>oDsxDj#R1B?1;e_nPHEyT`Aa|HNlJB9M82;)1 zr0Th9*dVM;qD&HXyx=?O2pdeJG2HQb{=n+=dE{Vpjf*l1!}Yx976s5Ph~W$WU#PYD zcbepWy3M|+kNO<|o;K?-rFbT-V4sbcq=BvF^7aQlB-z6BXH%I<6<6Ca;@!w00vxBl`d5TfT zXAHizajAb`+1a)#|CvcO#;CdZt#$9>f{G&oG;Mzm<`- zO5!w8WmmSY}L=@AE_GsFlauy zX?;~hLH){x2H|}4LsV+Zd8r)ucUt?h_L%TI#(~$*oy@rA%v(byMQ7B`xgd3m#q@}b zf&x<)xj)~Sr#|KbZM*X^yYMoqO7HvY-aT_CnvwmHyY>rGFjsr{H1T&K>hk_mU8GPM zgVl7Ei{Ql;g}N2BPrt3>>vXx7&uCG1+bYz&QOG*7m3~Jq5_NyI1m}Ht8T!E9_(b8) zpRe^wcudFDretZxpVr$(gx(K?K#lu9!qE74XW$<(MPCK`@2mA46uR7@{ttnss;Hq*DQ6z? F{{XrUj~@U4 literal 0 HcmV?d00001 From b66856c53f9eb966d1b87234a4d80e92d49bb775 Mon Sep 17 00:00:00 2001 From: geeksville Date: Mon, 17 Aug 2020 14:01:53 -0700 Subject: [PATCH 14/15] default back to tbeam --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 8970eee8..d887022f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,7 +9,7 @@ ; https://docs.platformio.org/page/projectconf.html [platformio] -default_envs = lora-relay-v1 +default_envs = tbeam # lora-relay-v1 [common] ; common is not currently used From 9c9347df23be399153345dc34713443bf084199e Mon Sep 17 00:00:00 2001 From: geeksville Date: Mon, 17 Aug 2020 14:06:31 -0700 Subject: [PATCH 15/15] don't reference tft libs on devices that don't have it --- src/graphics/TFT.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/graphics/TFT.cpp b/src/graphics/TFT.cpp index 3d9ea46e..7e2afb58 100644 --- a/src/graphics/TFT.cpp +++ b/src/graphics/TFT.cpp @@ -1,10 +1,10 @@ #include "configuration.h" +#ifdef ST7735_CS + #include #include // Graphics and font library for ST7735 driver chip -#ifdef ST7735_CS - TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in User_Setup.h void TFTinit()