rak3x72 : first commit
This commit is contained in:
committed by
Florent de Lamotte
parent
8ecb5def87
commit
f9473235c6
33
boards/rak3172.json
Normal file
33
boards/rak3172.json
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino": {
|
||||||
|
"variant_h": "variant_RAK3172_MODULE.h"
|
||||||
|
},
|
||||||
|
"core": "stm32",
|
||||||
|
"cpu": "cortex-m4",
|
||||||
|
"extra_flags": "-DSTM32WL -DSTM32WLxx -DSTM32WLE5xx",
|
||||||
|
"framework_extra_flags": {
|
||||||
|
"arduino": "-DUSE_CM4_STARTUP_FILE -DARDUINO_RAK3172_MODULE"
|
||||||
|
},
|
||||||
|
"f_cpu": "48000000L",
|
||||||
|
"mcu": "stm32wle5ccu",
|
||||||
|
"product_line": "STM32WLE5xx",
|
||||||
|
"variant": "STM32WLxx/WL54CCU_WL55CCU_WLE4C(8-B-C)U_WLE5C(8-B-C)U"
|
||||||
|
},
|
||||||
|
"debug": {
|
||||||
|
"default_tools": ["stlink"],
|
||||||
|
"jlink_device": "STM32WLE5CC",
|
||||||
|
"openocd_target": "stm32wlx",
|
||||||
|
"svd_path": "STM32WLE5_CM4.svd"
|
||||||
|
},
|
||||||
|
"frameworks": ["arduino"],
|
||||||
|
"name": "BB-STM32WL",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 65536,
|
||||||
|
"maximum_size": 262144,
|
||||||
|
"protocol": "stlink",
|
||||||
|
"protocols": ["stlink", "jlink"]
|
||||||
|
},
|
||||||
|
"url": "https://store.rakwireless.com/products/wisduo-lpwan-module-rak3172",
|
||||||
|
"vendor": "RAK"
|
||||||
|
}
|
||||||
@@ -126,6 +126,9 @@ InternalFileSystem::InternalFileSystem(void)
|
|||||||
|
|
||||||
bool InternalFileSystem::begin(void)
|
bool InternalFileSystem::begin(void)
|
||||||
{
|
{
|
||||||
|
#ifdef FORMAT_FS
|
||||||
|
this->format();
|
||||||
|
#endif
|
||||||
// failed to mount, erase all sector then format and mount again
|
// failed to mount, erase all sector then format and mount again
|
||||||
if ( !Adafruit_LittleFS::begin() )
|
if ( !Adafruit_LittleFS::begin() )
|
||||||
{
|
{
|
||||||
|
|||||||
33
variants/rak3x72/platformio.ini
Normal file
33
variants/rak3x72/platformio.ini
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
[rak3x72]
|
||||||
|
extends = stm32_base
|
||||||
|
board = rak3172
|
||||||
|
board_upload.maximum_size = 229376 ; 32kb for FS
|
||||||
|
build_flags = ${stm32_base.build_flags}
|
||||||
|
-D RADIO_CLASS=CustomSTM32WLx
|
||||||
|
-D WRAPPER_CLASS=CustomSTM32WLxWrapper
|
||||||
|
-D SPI_INTERFACES_COUNT=0
|
||||||
|
-D RX_BOOSTED_GAIN=true
|
||||||
|
-I variants/rak3x72
|
||||||
|
build_src_filter = ${stm32_base.build_src_filter}
|
||||||
|
+<../variants/rak3x72>
|
||||||
|
|
||||||
|
[env:rak3x72-repeater]
|
||||||
|
extends = rak3x72
|
||||||
|
build_flags = ${rak3x72.build_flags}
|
||||||
|
-D LORA_TX_POWER=22
|
||||||
|
-D ADVERT_NAME='"RAK3x72 Repeater"'
|
||||||
|
-D ADMIN_PASSWORD='"password"'
|
||||||
|
build_src_filter = ${rak3x72.build_src_filter}
|
||||||
|
+<../examples/simple_repeater/main.cpp>
|
||||||
|
|
||||||
|
[env:rak3x72_companion_radio_usb]
|
||||||
|
extends = rak3x72
|
||||||
|
build_flags = ${rak3x72.build_flags}
|
||||||
|
; -D FORMAT_FS=true
|
||||||
|
-D LORA_TX_POWER=22
|
||||||
|
-D MAX_CONTACTS=100
|
||||||
|
-D MAX_GROUP_CHANNELS=8
|
||||||
|
build_src_filter = ${rak3x72.build_src_filter}
|
||||||
|
+<../examples/companion_radio/*.cpp>
|
||||||
|
lib_deps = ${rak3x72.lib_deps}
|
||||||
|
densaugeo/base64 @ ~1.4.0
|
||||||
67
variants/rak3x72/target.cpp
Normal file
67
variants/rak3x72/target.cpp
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
#include <Arduino.h>
|
||||||
|
#include "target.h"
|
||||||
|
#include <helpers/ArduinoHelpers.h>
|
||||||
|
|
||||||
|
RAK3x72Board board;
|
||||||
|
|
||||||
|
RADIO_CLASS radio = new STM32WLx_Module();
|
||||||
|
|
||||||
|
WRAPPER_CLASS radio_driver(radio, board);
|
||||||
|
|
||||||
|
static const uint32_t rfswitch_pins[] = {LORAWAN_RFSWITCH_PINS, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC};
|
||||||
|
static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
|
{STM32WLx::MODE_IDLE, {LOW, LOW}},
|
||||||
|
{STM32WLx::MODE_RX, {HIGH, LOW}},
|
||||||
|
{STM32WLx::MODE_TX_LP, {LOW, HIGH}},
|
||||||
|
{STM32WLx::MODE_TX_HP, {LOW, HIGH}},
|
||||||
|
END_OF_MODE_TABLE,
|
||||||
|
};
|
||||||
|
|
||||||
|
VolatileRTCClock rtc_clock;
|
||||||
|
SensorManager sensors;
|
||||||
|
|
||||||
|
#ifndef LORA_CR
|
||||||
|
#define LORA_CR 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool radio_init() {
|
||||||
|
// rtc_clock.begin(Wire);
|
||||||
|
|
||||||
|
radio.setRfSwitchTable(rfswitch_pins, rfswitch_table);
|
||||||
|
|
||||||
|
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, 0, 0); // TCXO set to 0 for RAK3172
|
||||||
|
|
||||||
|
if (status != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print("ERROR: radio init failed: ");
|
||||||
|
Serial.println(status);
|
||||||
|
return false; // fail
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef RX_BOOSTED_GAIN
|
||||||
|
radio.setRxBoostedGainMode(RX_BOOSTED_GAIN);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
radio.setCRC(1);
|
||||||
|
|
||||||
|
return true; // success
|
||||||
|
}
|
||||||
|
|
||||||
|
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(uint8_t dbm) {
|
||||||
|
radio.setOutputPower(dbm);
|
||||||
|
}
|
||||||
|
|
||||||
|
mesh::LocalIdentity radio_new_identity() {
|
||||||
|
RadioNoiseListener rng(radio);
|
||||||
|
return mesh::LocalIdentity(&rng); // create new random identity
|
||||||
|
}
|
||||||
27
variants/rak3x72/target.h
Normal file
27
variants/rak3x72/target.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define RADIOLIB_STATIC_ONLY 1
|
||||||
|
#include <RadioLib.h>
|
||||||
|
#include <helpers/RadioLibWrappers.h>
|
||||||
|
#include <helpers/stm32/STM32Board.h>
|
||||||
|
#include <helpers/CustomSTM32WLxWrapper.h>
|
||||||
|
#include <helpers/ArduinoHelpers.h>
|
||||||
|
#include <helpers/SensorManager.h>
|
||||||
|
|
||||||
|
class RAK3x72Board : public STM32Board {
|
||||||
|
public:
|
||||||
|
const char* getManufacturerName() const override {
|
||||||
|
return "RAK 3x72";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
extern RAK3x72Board board;
|
||||||
|
extern WRAPPER_CLASS radio_driver;
|
||||||
|
extern VolatileRTCClock rtc_clock;
|
||||||
|
extern SensorManager sensors;
|
||||||
|
|
||||||
|
bool radio_init();
|
||||||
|
uint32_t radio_get_rng_seed();
|
||||||
|
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
|
||||||
|
void radio_set_tx_power(uint8_t dbm);
|
||||||
|
mesh::LocalIdentity radio_new_identity();
|
||||||
5
variants/rak3x72/variant.h
Normal file
5
variants/rak3x72/variant.h
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <variant_RAK3172_MODULE.h>
|
||||||
|
|
||||||
|
#undef RNG
|
||||||
@@ -6,6 +6,7 @@ build_flags = ${stm32_base.build_flags}
|
|||||||
-D RADIO_CLASS=CustomSTM32WLx
|
-D RADIO_CLASS=CustomSTM32WLx
|
||||||
-D WRAPPER_CLASS=CustomSTM32WLxWrapper
|
-D WRAPPER_CLASS=CustomSTM32WLxWrapper
|
||||||
-D SPI_INTERFACES_COUNT=0
|
-D SPI_INTERFACES_COUNT=0
|
||||||
|
-D RX_BOOSTED_GAIN=true
|
||||||
-I variants/wio-e5
|
-I variants/wio-e5
|
||||||
build_src_filter = ${stm32_base.build_src_filter}
|
build_src_filter = ${stm32_base.build_src_filter}
|
||||||
+<../variants/wio-e5>
|
+<../variants/wio-e5>
|
||||||
@@ -13,7 +14,7 @@ build_src_filter = ${stm32_base.build_src_filter}
|
|||||||
[env:wio-e5-repeater]
|
[env:wio-e5-repeater]
|
||||||
extends = lora_e5
|
extends = lora_e5
|
||||||
build_flags = ${lora_e5.build_flags}
|
build_flags = ${lora_e5.build_flags}
|
||||||
-D LORA_TX_POWER=20
|
-D LORA_TX_POWER=22
|
||||||
-D ADVERT_NAME='"WIO-E5 Repeater"'
|
-D ADVERT_NAME='"WIO-E5 Repeater"'
|
||||||
-D ADMIN_PASSWORD='"password"'
|
-D ADMIN_PASSWORD='"password"'
|
||||||
build_src_filter = ${lora_e5.build_src_filter}
|
build_src_filter = ${lora_e5.build_src_filter}
|
||||||
@@ -22,7 +23,7 @@ build_src_filter = ${lora_e5.build_src_filter}
|
|||||||
[env:wio-e5_companion_radio_usb]
|
[env:wio-e5_companion_radio_usb]
|
||||||
extends = lora_e5
|
extends = lora_e5
|
||||||
build_flags = ${lora_e5.build_flags}
|
build_flags = ${lora_e5.build_flags}
|
||||||
-D LORA_TX_POWER=20
|
-D LORA_TX_POWER=22
|
||||||
-D MAX_CONTACTS=100
|
-D MAX_CONTACTS=100
|
||||||
-D MAX_GROUP_CHANNELS=8
|
-D MAX_GROUP_CHANNELS=8
|
||||||
build_src_filter = ${lora_e5.build_src_filter}
|
build_src_filter = ${lora_e5.build_src_filter}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include <helpers/ArduinoHelpers.h>
|
#include <helpers/ArduinoHelpers.h>
|
||||||
|
|
||||||
STM32Board board;
|
WIOE5Board board;
|
||||||
|
|
||||||
RADIO_CLASS radio = new STM32WLx_Module();
|
RADIO_CLASS radio = new STM32WLx_Module();
|
||||||
|
|
||||||
@@ -42,7 +42,11 @@ bool radio_init() {
|
|||||||
Serial.println(status);
|
Serial.println(status);
|
||||||
return false; // fail
|
return false; // fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef RX_BOOSTED_GAIN
|
||||||
|
radio.setRxBoostedGainMode(RX_BOOSTED_GAIN);
|
||||||
|
#endif
|
||||||
|
|
||||||
radio.setCRC(1);
|
radio.setCRC(1);
|
||||||
|
|
||||||
return true; // success
|
return true; // success
|
||||||
|
|||||||
@@ -8,7 +8,14 @@
|
|||||||
#include <helpers/ArduinoHelpers.h>
|
#include <helpers/ArduinoHelpers.h>
|
||||||
#include <helpers/SensorManager.h>
|
#include <helpers/SensorManager.h>
|
||||||
|
|
||||||
extern STM32Board board;
|
class WIOE5Board : public STM32Board {
|
||||||
|
public:
|
||||||
|
const char* getManufacturerName() const override {
|
||||||
|
return "Seeed Wio E5";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
extern WIOE5Board board;
|
||||||
extern WRAPPER_CLASS radio_driver;
|
extern WRAPPER_CLASS radio_driver;
|
||||||
extern VolatileRTCClock rtc_clock;
|
extern VolatileRTCClock rtc_clock;
|
||||||
extern SensorManager sensors;
|
extern SensorManager sensors;
|
||||||
|
|||||||
Reference in New Issue
Block a user