From a287d7b01c427707cfb261a3162d677b3ccac220 Mon Sep 17 00:00:00 2001 From: "jacob.eva" Date: Sat, 20 Jul 2024 16:47:01 +0100 Subject: [PATCH] Add rak4631_sx1280 and freenode board variant targets --- Boards.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- Makefile | 22 ++++++++++++++++++---- ROM.h | 3 ++- Utilities.h | 4 +--- 4 files changed, 73 insertions(+), 9 deletions(-) diff --git a/Boards.h b/Boards.h index a3512fb..c8c4d94 100644 --- a/Boards.h +++ b/Boards.h @@ -629,7 +629,7 @@ #endif #elif MCU_VARIANT == MCU_NRF52 - #if BOARD_MODEL == BOARD_RAK4631 + #if BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_FREENODE #define HAS_EEPROM false #define HAS_DISPLAY true #define DISPLAY EINK_BW @@ -647,6 +647,7 @@ #define BLE_MANUFACTURER "RAK Wireless" #define BLE_MODEL "RAK4640" + #if BOARD_VARIANT == MODEL_11 || BOARD_VARIANT == MODEL_12 #define INTERFACE_COUNT 1 // first interface in list is the primary @@ -674,6 +675,56 @@ -1 // pin_tcxo_enable } }; + #elif BOARD_VARIANT == MODEL_13 || BOARD_VARIANT == MODEL_14 || BOARD_VARIANT == MODEL_21 + #define INTERFACE_COUNT 2 + + #define CONFIG_QUEUE_1_SIZE 20000 + + // first interface in list is the primary + const uint8_t interfaces[INTERFACE_COUNT] = {SX126X, SX128X}; + const bool interface_cfg[INTERFACE_COUNT][3] = { + // SX1262 + { + false, // DEFAULT_SPI + true, // HAS_TCXO + true // DIO2_AS_RF_SWITCH + }, + // SX1280 + { + true, // DEFAULT_SPI + false,// HAS_TCXO + false // DIO2_AS_RF_SWITCH + } + }; + const int8_t interface_pins[INTERFACE_COUNT][10] = { + // SX1262 + { + 42, // pin_ss + 43, // pin_sclk + 44, // pin_mosi + 45, // pin_miso + 46, // pin_busy + 47, // pin_dio + 38, // pin_reset + -1, // pin_txen + 37, // pin_rxen + -1 // pin_tcxo_enable + }, + // SX1280 + { + 24, // pin_ss + 3, // pin_sclk + 30, // pin_mosi + 29, // pin_miso + 25, // pin_busy + 15, // pin_dio + 16, // pin_reset + 20, // pin_txen + 19, // pin_rxen + -1 // pin_tcxo_enable + } + }; + #endif #define INTERFACE_SPI // Required because on RAK4631, non-default SPI pins must be initialised when class is declared. diff --git a/Makefile b/Makefile index f4712e0..fa92457 100644 --- a/Makefile +++ b/Makefile @@ -117,7 +117,13 @@ firmware-genericesp32: arduino-cli compile --fqbn esp32:esp32:esp32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x35\"" firmware-rak4631: - arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\"" + arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\" \"-DBOARD_VARIANT=0x12\"" + +firmware-rak4631_sx1280: + arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\" \"-DBOARD_VARIANT=0x14\"" + +firmware-freenode: + arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\" \"-DBOARD_VARIANT=0x21\"" upload: arduino-cli upload -p /dev/ttyUSB0 --fqbn unsignedio:avr:rnode @@ -206,8 +212,6 @@ upload-rak4631: unzip -o build/rakwireless.nrf52.WisCoreRAK4631Board/RNode_Firmware_CE.ino.zip -d build/rakwireless.nrf52.WisCoreRAK4631Board rnodeconf /dev/ttyACM0 --firmware-hash $$(sha256sum ./build/rakwireless.nrf52.WisCoreRAK4631Board/RNode_Firmware_CE.ino.bin | grep -o '^\S*') - - release: release-all release-all: console-site spiffs-image release-tbeam release-tbeam_sx1262 release-lora32_v10 release-lora32_v20 release-lora32_v21 release-lora32_v10_extled release-lora32_v20_extled release-lora32_v21_extled release-lora32_v21_tcxo release-featheresp32 release-genericesp32 release-heltec32_v2 release-heltec32_v3 release-heltec32_v2_extled release-rnode_ng_20 release-rnode_ng_21 release-t3s3 release-hashes @@ -374,6 +378,16 @@ release-mega2560: rm -r build release-rak4631: - arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\"" + arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\" \"-DBOARD_VARIANT=0x12\"" cp build/rakwireless.nrf52.WisCoreRAK4631Board/RNode_Firmware_CE.ino.hex build/rnode_firmware_rak4631.hex adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/rnode_firmware_rak4631.hex Release/rnode_firmware_rak4631.zip + +release-rak4631_sx1280: + arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\" \"-DBOARD_VARIANT=0x14\"" + cp build/rakwireless.nrf52.WisCoreRAK4631Board/RNode_Firmware_CE.ino.hex build/rnode_firmware_rak4631_sx1280.hex + adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/rnode_firmware_rak4631_sx1280.hex Release/rnode_firmware_rak4631_sx1280.zip + +release-freenode: + arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\" \"-DBOARD_VARIANT=0x21\"" + cp build/rakwireless.nrf52.WisCoreRAK4631Board/RNode_Firmware_CE.ino.hex build/rnode_firmware_freenode.hex + adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/rnode_firmware_freenode.hex Release/rnode_firmware_freenode.zip diff --git a/ROM.h b/ROM.h index 2998635..323449d 100644 --- a/ROM.h +++ b/ROM.h @@ -30,7 +30,8 @@ #define PRODUCT_FREENODE 0x20 #define MODEL_11 0x11 #define MODEL_12 0x12 - #define MODEL_13 0x13 // RAK4631 with WisBlock SX1280 module (LIBSYS002) + #define MODEL_13 0x13 // RAK4631 LF with WisBlock SX1280 module (LIBSYS002) + #define MODEL_14 0x14 // RAK4631 HF with WisBlock SX1280 module (LIBSYS002) #define MODEL_21 0x21 // European band, 868MHz #define MODEL_A1 0xA1 #define MODEL_A5 0xA5 // T3S3 SX1280 PA diff --git a/Utilities.h b/Utilities.h index 17a6fa9..3f0a8b8 100644 --- a/Utilities.h +++ b/Utilities.h @@ -1361,9 +1361,7 @@ bool eeprom_model_valid() { #elif BOARD_MODEL == BOARD_HELTEC32_V3 if (model == MODEL_C5 || model == MODEL_CA) { #elif BOARD_MODEL == BOARD_RAK4631 - if (model == MODEL_11 || model == MODEL_12) { - #elif BOARD_MODEL == BOARD_FREENODE - if (model == MODEL_21) { + if (model == MODEL_11 || model == MODEL_12 || model == MODEL_13 || model == MODEL_14 || model == MODEL_21) { #elif BOARD_MODEL == BOARD_HUZZAH32 if (model == MODEL_FF) { #elif BOARD_MODEL == BOARD_GENERIC_ESP32