diff --git a/boards/wiscore_rak11200.json b/boards/wiscore_rak11200.json new file mode 100644 index 000000000..6d794b14a --- /dev/null +++ b/boards/wiscore_rak11200.json @@ -0,0 +1,39 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32_out.ld" + }, + "core": "esp32", + "extra_flags": "-DARDUINO_ESP32_DEV", + "f_cpu": "240000000L", + "f_flash": "40000000L", + "flash_mode": "dio", + "mcu": "esp32", + "variant": "WisCore_RAK11200_Board" + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet", + "can" + ], + "frameworks": [ + "arduino", + "espidf" + ], + "name": "WisCore RAK11200 Board", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "protocols": [ + "esptool", + "espota", + "ftdi" + ], + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://www.rakwireless.com", + "vendor": "RAKwireless" +} diff --git a/src/configuration.h b/src/configuration.h index 321881599..3831e1455 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -161,6 +161,10 @@ along with this program. If not, see . // This string must exactly match the case used in release file names or the android updater won't work #define HW_VENDOR HardwareModel_DIY_V1 +#elif defined(RAK_11200) +// This string must exactly match the case used in release file names or the android updater won't work +#define HW_VENDOR HardwareModel_RAK11200 + #elif defined(ARDUINO_HELTEC_WIFI_LORA_32_V2) #ifdef HELTEC_V2_0 diff --git a/variants/WisCore_RAK11200_Board/platformio.ini b/variants/WisCore_RAK11200_Board/platformio.ini new file mode 100644 index 000000000..affb8908c --- /dev/null +++ b/variants/WisCore_RAK11200_Board/platformio.ini @@ -0,0 +1,5 @@ +[env:rak11200] +extends = esp32_base +board = wiscore_rak11200 +build_flags = + ${esp32_base.build_flags} -D RAK_11200 -I variants/WisCore_RAK11200_Board \ No newline at end of file diff --git a/variants/WisCore_RAK11200_Board/variant.h b/variants/WisCore_RAK11200_Board/variant.h new file mode 100644 index 000000000..7cd5d0892 --- /dev/null +++ b/variants/WisCore_RAK11200_Board/variant.h @@ -0,0 +1,80 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 16 +#define NUM_DIGITAL_PINS 40 +#define NUM_ANALOG_INPUTS 16 + +#define analogInputToDigitalPin(p) (((p) < 20) ? (esp32_adc2gpio[(p)]) : -1) +#define digitalPinToInterrupt(p) (((p) < 40) ? (p) : -1) +#define digitalPinHasPWM(p) (p < 34) + +#define LED_GREEN 12 +#define LED_BLUE 2 + +#define LED_BUILTIN LED_GREEN + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +#define TX1 21 +#define RX1 19 + +#define WB_IO1 14 +#define WB_IO2 27 +#define WB_IO3 26 +#define WB_IO4 23 +#define WB_IO5 13 +#define WB_IO6 22 +#define WB_SW1 34 +#define WB_A0 36 +#define WB_A1 39 +#define WB_CS 32 +#define WB_LED1 12 +#define WB_LED2 2 + +static const uint8_t SDA = 4; +static const uint8_t SCL = 5; + +static const uint8_t SS = 32; +static const uint8_t MOSI = 25; +static const uint8_t MISO = 35; +static const uint8_t SCK = 33; + +/* -------- Meshtastic pins -------- */ + +#define I2C_SDA SDA +#define I2C_SCL SCL + +#define GPS_RX_PIN RX +#define GPS_RX_PIN TX + +#define LED_PIN LED_BLUE + +#define PIN_VBAT WB_A0 + +// https://docs.rakwireless.com/Product-Categories/WisBlock/RAK13300/ + +#define LORA_DIO0 26 // a No connect on the SX1262/SX1268 module +#define LORA_RESET WB_IO4 // RST for SX1276, and for SX1262/SX1268 +#define LORA_DIO1 WB_IO6 // IRQ for SX1262/SX1268 +#define LORA_DIO2 WB_IO5 // BUSY for SX1262/SX1268 +#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262/SX1268, if DIO3 is high the TXCO is enabled + +// This is a hack for the radio pin run-around with ESP32 variants +#define RF95_SCK SCK +#define RF95_MISO MISO +#define RF95_MOSI MOSI +#define RF95_NSS SS + +#define USE_SX1262 +#define SX126X_CS (RF95_NSS)// NSS for SX126X +#define SX126X_DIO1 (LORA_DIO1) +#define SX126X_BUSY (LORA_DIO2) +#define SX126X_RESET (LORA_RESET) +#define SX126X_TXEN (-1) +#define SX126X_RXEN (WB_IO3) +#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +#endif /* Pins_Arduino_h */