-
Notifications
You must be signed in to change notification settings - Fork 626
Add RAK11200 / RAK13300 variant #1925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
weebl2000
wants to merge
7
commits into
meshcore-dev:dev
Choose a base branch
from
weebl2000:ashinn/rak11200-support-rebased
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5ab34d5
adding the RAK13300 / RAK11200 ESP32 variant pair
andyshinn 5afe5c2
LORA_BUSY is actually connected, oops
andyshinn 096f601
disable some sensors we don't use that have long timeouts on boot
andyshinn 6bbffc7
better default multiplier for ESP32 RAK
andyshinn d9a555c
fix RAK11200 variant: pin corrections and convention alignment
weebl2000 5695725
remove adc override
weebl2000 23f7390
Add wifi variant
weebl2000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| { | ||
| "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" | ||
| ], | ||
| "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" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #include "RAK11200Board.h" | ||
|
|
||
| void RAK11200Board::begin() { | ||
| ESP32Board::begin(); | ||
|
|
||
| pinMode(PIN_VBAT_READ, INPUT); | ||
|
|
||
| pinMode(SX126X_POWER_EN, OUTPUT); | ||
| digitalWrite(SX126X_POWER_EN, HIGH); | ||
| delay(10); // give sx1262 some time to power up | ||
|
|
||
| #ifdef PIN_USER_BTN | ||
| pinMode(PIN_USER_BTN, INPUT_PULLUP); | ||
| #endif | ||
|
|
||
| #ifdef PIN_USER_BTN_ANA | ||
| pinMode(PIN_USER_BTN_ANA, INPUT_PULLUP); | ||
| #endif | ||
| } | ||
|
|
||
| const char* RAK11200Board::getManufacturerName() const { | ||
| return "RAK 11200"; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #pragma once | ||
|
|
||
| #include <Arduino.h> | ||
| #include <helpers/ESP32Board.h> | ||
|
|
||
| // LoRa radio module pins when paired with the RAK13300 SX1262 module | ||
| #define P_LORA_DIO_1 22 // GPIO22 (ESP32 pin 36 -> IO6/DIO1) | ||
| #define P_LORA_NSS 32 // GPIO32 (ESP32 pin 8 -> SPI_CS) | ||
| #define P_LORA_RESET 23 // GPIO23 (ESP32 pin 37 -> IO4/NRESET) | ||
| #define P_LORA_BUSY 13 // GPIO13 (ESP32 pin 16 -> IO5) | ||
| #define P_LORA_SCLK 33 // GPIO33 (ESP32 pin 9 -> SPI_SCK) | ||
| #define P_LORA_MISO 35 // GPIO35 (ESP32 pin 7 -> SPI_MISO) | ||
| #define P_LORA_MOSI 25 // GPIO25 (ESP32 pin 10 -> SPI_MOSI) | ||
| #define SX126X_POWER_EN 27 // GPIO27 (ESP32 pin 12 -> IO2) | ||
| #define PIN_VBAT_READ 36 // WB_A0 for battery reading | ||
|
|
||
| class RAK11200Board : public ESP32Board { | ||
|
|
||
| public: | ||
| void begin(); | ||
| const char* getManufacturerName() const override; | ||
|
|
||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| #ifndef Pins_Arduino_h | ||
| #define Pins_Arduino_h | ||
|
|
||
| #ifndef _VARIANT_RAK11200_ | ||
| #define _VARIANT_RAK11200_ | ||
| #endif | ||
|
|
||
| #include <stdint.h> | ||
|
|
||
| #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; | ||
|
|
||
| #endif /* Pins_Arduino_h */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| [rak11200] | ||
| extends = esp32_base | ||
| board = wiscore_rak11200 | ||
| board_build.partitions = min_spiffs.csv ; get around 4mb flash limit | ||
| build_flags = | ||
| ${esp32_base.build_flags} | ||
| ${sensor_base.build_flags} | ||
| -I variants/rak11200 | ||
| -D RAK_11200 | ||
| -D RAK_BOARD | ||
| -D PIN_BOARD_SCL=5 | ||
| -D PIN_BOARD_SDA=4 | ||
| -D PIN_GPS_TX=21 | ||
| -D PIN_GPS_RX=19 | ||
| -D PIN_GPS_EN=-1 | ||
| -D PIN_OLED_RESET=-1 | ||
| -D RADIO_CLASS=CustomSX1262 | ||
| -D WRAPPER_CLASS=CustomSX1262Wrapper | ||
| -D LORA_TX_POWER=22 | ||
| -D SX126X_CURRENT_LIMIT=140 | ||
| -D SX126X_DIO2_AS_RF_SWITCH=true | ||
| -D SX126X_DIO3_TCXO_VOLTAGE=1.8 | ||
| -D ENV_INCLUDE_GPS=0 | ||
| -D RAK_WISBLOCK_GPS=0 | ||
| -D ENV_INCLUDE_INA3221=0 | ||
| -D ENV_INCLUDE_VL53L0X=0 ; Has a fairly long timeout of 40 seconds so we disable to prevent that startup delay | ||
| -D DISPLAY_CLASS=NullDisplayDriver | ||
| build_src_filter = ${esp32_base.build_src_filter} | ||
| +<../variants/rak11200> | ||
| +<helpers/sensors> | ||
| +<helpers/ui/NullDisplayDriver.cpp> | ||
| +<helpers/ui/MomentaryButton.cpp> | ||
| lib_deps = | ||
| ${esp32_base.lib_deps} | ||
| ${sensor_base.lib_deps} | ||
| sparkfun/SparkFun u-blox GNSS Arduino Library@^2.2.27 | ||
|
|
||
| [env:RAK_11200_Repeater] | ||
| extends = rak11200 | ||
| build_flags = | ||
| ${rak11200.build_flags} | ||
| -D ADVERT_NAME='"RAK11200 Repeater"' | ||
| -D ADVERT_LAT=0.0 | ||
| -D ADVERT_LON=0.0 | ||
| -D ADMIN_PASSWORD='"password"' | ||
| -D MAX_NEIGHBOURS=8 | ||
| ; -D MESH_PACKET_LOGGING=1 | ||
| ; -D MESH_DEBUG=1 | ||
| build_src_filter = ${rak11200.build_src_filter} | ||
| +<../examples/simple_repeater> | ||
| lib_deps = | ||
| ${rak11200.lib_deps} | ||
| ${esp32_ota.lib_deps} | ||
|
|
||
| [env:RAK_11200_room_server] | ||
| extends = rak11200 | ||
| build_flags = | ||
| ${rak11200.build_flags} | ||
| -D ADVERT_NAME='"Test Room"' | ||
| -D ADVERT_LAT=0.0 | ||
| -D ADVERT_LON=0.0 | ||
| -D ADMIN_PASSWORD='"password"' | ||
| -D ROOM_PASSWORD='"hello"' | ||
| ; -D MESH_PACKET_LOGGING=1 | ||
| ; -D MESH_DEBUG=1 | ||
| build_src_filter = ${rak11200.build_src_filter} | ||
| +<../examples/simple_room_server> | ||
| lib_deps = | ||
| ${rak11200.lib_deps} | ||
| ${esp32_ota.lib_deps} | ||
|
|
||
| [env:RAK_11200_companion_radio_usb] | ||
| extends = rak11200 | ||
| build_flags = | ||
| ${rak11200.build_flags} | ||
| -I examples/companion_radio/ui-orig | ||
| -D PIN_USER_BTN=34 | ||
| -D PIN_USER_BTN_ANA=36 | ||
| -D MAX_CONTACTS=100 | ||
| -D MAX_GROUP_CHANNELS=8 | ||
| ; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1 | ||
| ; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1 | ||
| build_src_filter = ${rak11200.build_src_filter} | ||
| +<../examples/companion_radio/*.cpp> | ||
| +<../examples/companion_radio/ui-orig/*.cpp> | ||
| lib_deps = | ||
| ${rak11200.lib_deps} | ||
| ${esp32_ota.lib_deps} | ||
| densaugeo/base64 @ ~1.4.0 | ||
|
|
||
| [env:RAK_11200_companion_radio_ble] | ||
| extends = rak11200 | ||
| build_flags = | ||
| ${rak11200.build_flags} | ||
| -I examples/companion_radio/ui-orig | ||
| -D PIN_USER_BTN=34 | ||
| -D PIN_USER_BTN_ANA=36 | ||
| -D MAX_CONTACTS=100 | ||
| -D MAX_GROUP_CHANNELS=8 | ||
| -D BLE_PIN_CODE=123456 | ||
| -D BLE_DEBUG_LOGGING=1 | ||
| -D OFFLINE_QUEUE_SIZE=256 | ||
| ; -D MESH_PACKET_LOGGING=1 | ||
| ; -D MESH_DEBUG=1 | ||
| build_src_filter = ${rak11200.build_src_filter} | ||
| +<helpers/esp32/SerialBLEInterface.cpp> | ||
| +<../examples/companion_radio/*.cpp> | ||
| +<../examples/companion_radio/ui-orig/*.cpp> | ||
| lib_deps = | ||
| ${rak11200.lib_deps} | ||
| ${esp32_ota.lib_deps} | ||
| densaugeo/base64 @ ~1.4.0 | ||
|
|
||
| [env:RAK_11200_companion_radio_wifi] | ||
| extends = rak11200 | ||
| build_flags = | ||
| ${rak11200.build_flags} | ||
| -I examples/companion_radio/ui-orig | ||
| -D PIN_USER_BTN=34 | ||
| -D PIN_USER_BTN_ANA=36 | ||
| -D MAX_CONTACTS=100 | ||
| -D MAX_GROUP_CHANNELS=8 | ||
| -D WIFI_DEBUG_LOGGING=1 | ||
| -D WIFI_SSID='"myssid"' | ||
| -D WIFI_PWD='"mypwd"' | ||
| -D OFFLINE_QUEUE_SIZE=256 | ||
| ; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1 | ||
| ; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1 | ||
| build_src_filter = ${rak11200.build_src_filter} | ||
| +<helpers/esp32/SerialWifiInterface.cpp> | ||
| +<../examples/companion_radio/*.cpp> | ||
| +<../examples/companion_radio/ui-orig/*.cpp> | ||
| lib_deps = | ||
| ${rak11200.lib_deps} | ||
| ${esp32_ota.lib_deps} | ||
| densaugeo/base64 @ ~1.4.0 | ||
|
|
||
| [env:RAK_11200_terminal_chat] | ||
| extends = rak11200 | ||
| build_flags = | ||
| ${rak11200.build_flags} | ||
| -D PIN_USER_BTN=34 | ||
| -D PIN_USER_BTN_ANA=36 | ||
| -D MAX_CONTACTS=100 | ||
| -D MAX_GROUP_CHANNELS=1 | ||
| ; -D MESH_PACKET_LOGGING=1 | ||
| ; -D MESH_DEBUG=1 | ||
| build_src_filter = ${rak11200.build_src_filter} | ||
| +<../examples/simple_secure_chat/main.cpp> | ||
| lib_deps = | ||
| ${rak11200.lib_deps} | ||
| ${esp32_ota.lib_deps} | ||
| densaugeo/base64 @ ~1.4.0 | ||
|
|
||
| [env:RAK_11200_sensor] | ||
| extends = rak11200 | ||
| build_flags = | ||
| ${rak11200.build_flags} | ||
| -D ADVERT_NAME='"RAK11200 Sensor"' | ||
| -D ADVERT_LAT=0.0 | ||
| -D ADVERT_LON=0.0 | ||
| -D ADMIN_PASSWORD='"password"' | ||
| ; -D MESH_PACKET_LOGGING=1 | ||
| -D MESH_DEBUG=1 | ||
| build_src_filter = ${rak11200.build_src_filter} | ||
| +<../examples/simple_sensor> | ||
| lib_deps = | ||
| ${rak11200.lib_deps} | ||
| ${esp32_ota.lib_deps} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| #include <Arduino.h> | ||
| #include "target.h" | ||
| #include <helpers/ArduinoHelpers.h> | ||
|
|
||
| RAK11200Board board; | ||
|
|
||
| #ifndef PIN_USER_BTN | ||
| #define PIN_USER_BTN (-1) | ||
| #endif | ||
|
|
||
| #ifdef DISPLAY_CLASS | ||
| DISPLAY_CLASS display; | ||
| MomentaryButton user_btn(PIN_USER_BTN, 1000, true, true); | ||
|
|
||
| #if defined(PIN_USER_BTN_ANA) | ||
| MomentaryButton analog_btn(PIN_USER_BTN_ANA, 1000, 20); | ||
| #endif | ||
| #endif | ||
|
|
||
| #if defined(P_LORA_SCLK) | ||
| static SPIClass spi; | ||
| RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi); | ||
| #else | ||
| RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY); | ||
| #endif | ||
|
|
||
| WRAPPER_CLASS radio_driver(radio, board); | ||
|
|
||
| VolatileRTCClock fallback_clock; | ||
| AutoDiscoverRTCClock rtc_clock(fallback_clock); | ||
|
|
||
| #if ENV_INCLUDE_GPS | ||
| #include <helpers/sensors/MicroNMEALocationProvider.h> | ||
| MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1); | ||
| EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea); | ||
| #else | ||
| EnvironmentSensorManager sensors; | ||
| #endif | ||
|
|
||
| bool radio_init() { | ||
| rtc_clock.begin(Wire); | ||
|
|
||
| #if defined(P_LORA_SCLK) | ||
| return radio.std_init(&spi); | ||
| #else | ||
| return radio.std_init(); | ||
| #endif | ||
| } | ||
|
|
||
| uint32_t radio_get_rng_seed() { | ||
| return radio.random(0x7FFFFFFF); | ||
| } | ||
|
|
||
| void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr) { | ||
| radio.setFrequency(freq); | ||
| radio.setSpreadingFactor(sf); | ||
| radio.setBandwidth(bw); | ||
| radio.setCodingRate(cr); | ||
| } | ||
|
|
||
| void radio_set_tx_power(int8_t dbm) { | ||
| radio.setOutputPower(dbm); | ||
| } | ||
|
|
||
| mesh::LocalIdentity radio_new_identity() { | ||
| RadioNoiseListener rng(radio); | ||
| return mesh::LocalIdentity(&rng); // create new random identity | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.