Wessel 2 days ago
committed by GitHub
parent
commit
d1bf51c98b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      docs/faq.md
  2. 2
      library.json
  3. 21
      src/helpers/radiolib/CustomLLCC68.h
  4. 29
      src/helpers/radiolib/CustomSX1262.h
  5. 21
      src/helpers/radiolib/CustomSX1268.h
  6. 14
      src/helpers/radiolib/CustomSX1276.h
  7. 28
      src/helpers/radiolib/SX126xReset.h
  8. 14
      variants/ebyte_eora_s3/target.cpp
  9. 14
      variants/minewsemi_me25ls01/target.cpp
  10. 11
      variants/rak3x72/target.cpp
  11. 14
      variants/t1000-e/target.cpp
  12. 14
      variants/thinknode_m3/target.cpp
  13. 12
      variants/tiny_relay/target.cpp
  14. 11
      variants/wio-e5-dev/target.cpp
  15. 11
      variants/wio-e5-mini/target.cpp
  16. 16
      variants/wio_wm1110/target.cpp

2
docs/faq.md

@ -284,7 +284,7 @@ Best practice is when you set up a new repeater, choose a public key that is not
The `<number>` unit is in seconds and is incremented by 4. `set agc.reset.interval 4` works well to cure deafness.
This is a very low-cost operation. AGC reset is done by simply setting `state = STATE_IDLE;` in function `RadioLibWrapper::resetAGC()` in `RadioLibWrappers.cpp`
This is a low-cost operation (a few milliseconds). The reset performs a warm sleep to power down the radio's analog frontend, recalibrates all blocks (ADC, PLL, image rejection, oscillators), and resets the noise floor tracking. See `RadioLibWrapper::resetAGC()` in `RadioLibWrappers.cpp`.
### 3.8. Q: How do I make my repeater an observer on the mesh?

2
library.json

@ -4,7 +4,7 @@
"dependencies": {
"SPI": "*",
"Wire": "*",
"jgromes/RadioLib": "^7.6.0",
"RadioLib": "https://github.com/jgromes/RadioLib.git#6d8934836678d8894e3d556550475b37dce3e2b6",
"rweather/Crypto": "^0.4.0",
"adafruit/RTClib": "^2.1.3",
"melopero/Melopero RV3028": "^1.1.0",

21
src/helpers/radiolib/CustomLLCC68.h

@ -13,16 +13,23 @@ class CustomLLCC68 : public LLCC68 {
#endif
{
#ifdef SX126X_DIO3_TCXO_VOLTAGE
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE;
#else
float tcxo = 1.6f;
tcxoVoltage = 1.6f;
#endif
ConfigLoRa_t cfg;
cfg.frequency = LORA_FREQ;
cfg.bandwidth = LORA_BW;
cfg.spreadingFactor = LORA_SF;
#ifdef LORA_CR
uint8_t cr = LORA_CR;
cfg.codingRate = LORA_CR;
#else
uint8_t cr = 5;
cfg.codingRate = 5;
#endif
cfg.syncWord = RADIOLIB_LORA_SYNC_WORD_PRIVATE;
cfg.power = LORA_TX_POWER;
cfg.preambleLength = 16;
#if defined(P_LORA_SCLK)
#ifdef NRF52_PLATFORM
@ -39,11 +46,11 @@ class CustomLLCC68 : public LLCC68 {
if (spi) spi->begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
#endif
#endif
int status = begin(LORA_FREQ, LORA_BW, LORA_SF, cr, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 16, tcxo);
int status = begin(cfg);
// if radio init fails with -707/-706, try again with tcxo voltage set to 0.0f
if (status == RADIOLIB_ERR_SPI_CMD_FAILED || status == RADIOLIB_ERR_SPI_CMD_INVALID) {
tcxo = 0.0f;
status = begin(LORA_FREQ, LORA_BW, LORA_SF, cr, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 16, tcxo);
tcxoVoltage = 0.0f;
status = begin(cfg);
}
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");

29
src/helpers/radiolib/CustomSX1262.h

@ -19,22 +19,27 @@ class CustomSX1262 : public SX1262 {
#endif
{
#ifdef SX126X_DIO3_TCXO_VOLTAGE
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE;
#else
float tcxo = 1.6f;
tcxoVoltage = 1.6f;
#endif
#ifdef LORA_CR
uint8_t cr = LORA_CR;
#else
uint8_t cr = 5;
#ifdef SX126X_USE_REGULATOR_LDO
useRegulatorLDO = SX126X_USE_REGULATOR_LDO;
#endif
#ifdef SX126X_USE_REGULATOR_LDO
constexpr bool useRegulatorLDO = SX126X_USE_REGULATOR_LDO;
ConfigLoRa_t cfg;
cfg.frequency = LORA_FREQ;
cfg.bandwidth = LORA_BW;
cfg.spreadingFactor = LORA_SF;
#ifdef LORA_CR
cfg.codingRate = LORA_CR;
#else
constexpr bool useRegulatorLDO = false;
cfg.codingRate = 5;
#endif
cfg.syncWord = RADIOLIB_LORA_SYNC_WORD_PRIVATE;
cfg.power = LORA_TX_POWER;
cfg.preambleLength = 16;
MESH_DEBUG_PRINTLN("SX1262 regulator requested: %s", useRegulatorLDO ? "LDO" : "DC-DC");
@ -53,12 +58,12 @@ class CustomSX1262 : public SX1262 {
if (spi) spi->begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
#endif
#endif
int status = begin(LORA_FREQ, LORA_BW, LORA_SF, cr, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 16, tcxo, useRegulatorLDO);
int status = begin(cfg);
// if radio init fails with -707/-706, try again with tcxo voltage set to 0.0f
if (status == RADIOLIB_ERR_SPI_CMD_FAILED || status == RADIOLIB_ERR_SPI_CMD_INVALID) {
MESH_DEBUG_PRINTLN("SX1262 init failed with error %d, retrying with TCXO at 0.0V", status);
tcxo = 0.0f;
status = begin(LORA_FREQ, LORA_BW, LORA_SF, cr, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 16, tcxo, useRegulatorLDO);
tcxoVoltage = 0.0f;
status = begin(cfg);
}
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");

21
src/helpers/radiolib/CustomSX1268.h

@ -13,16 +13,23 @@ class CustomSX1268 : public SX1268 {
#endif
{
#ifdef SX126X_DIO3_TCXO_VOLTAGE
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE;
#else
float tcxo = 1.6f;
tcxoVoltage = 1.6f;
#endif
ConfigLoRa_t cfg;
cfg.frequency = LORA_FREQ;
cfg.bandwidth = LORA_BW;
cfg.spreadingFactor = LORA_SF;
#ifdef LORA_CR
uint8_t cr = LORA_CR;
cfg.codingRate = LORA_CR;
#else
uint8_t cr = 5;
cfg.codingRate = 5;
#endif
cfg.syncWord = RADIOLIB_LORA_SYNC_WORD_PRIVATE;
cfg.power = LORA_TX_POWER;
cfg.preambleLength = 16;
#if defined(P_LORA_SCLK)
#ifdef NRF52_PLATFORM
@ -39,11 +46,11 @@ class CustomSX1268 : public SX1268 {
if (spi) spi->begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
#endif
#endif
int status = begin(LORA_FREQ, LORA_BW, LORA_SF, cr, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 16, tcxo);
int status = begin(cfg);
// if radio init fails with -707/-706, try again with tcxo voltage set to 0.0f
if (status == RADIOLIB_ERR_SPI_CMD_FAILED || status == RADIOLIB_ERR_SPI_CMD_INVALID) {
tcxo = 0.0f;
status = begin(LORA_FREQ, LORA_BW, LORA_SF, cr, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 16, tcxo);
tcxoVoltage = 0.0f;
status = begin(cfg);
}
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");

14
src/helpers/radiolib/CustomSX1276.h

@ -18,11 +18,18 @@ class CustomSX1276 : public SX1276 {
bool std_init(SPIClass* spi = NULL)
#endif
{
ConfigLoRa_t cfg;
cfg.frequency = LORA_FREQ;
cfg.bandwidth = LORA_BW;
cfg.spreadingFactor = LORA_SF;
#ifdef LORA_CR
uint8_t cr = LORA_CR;
cfg.codingRate = LORA_CR;
#else
uint8_t cr = 5;
cfg.codingRate = 5;
#endif
cfg.syncWord = RADIOLIB_LORA_SYNC_WORD_PRIVATE;
cfg.power = LORA_TX_POWER;
cfg.preambleLength = 16;
#if defined(P_LORA_SCLK)
#ifdef NRF52_PLATFORM
@ -39,8 +46,7 @@ class CustomSX1276 : public SX1276 {
if (spi) spi->begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
#endif
#endif
int status = begin(LORA_FREQ, LORA_BW, LORA_SF, cr, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 16);
// if radio init fails with -707/-706, try again with tcxo voltage set to 0.0f
int status = begin(cfg);
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");
Serial.println(status);

28
src/helpers/radiolib/SX126xReset.h

@ -3,32 +3,14 @@
#include <RadioLib.h>
// Full receiver reset for all SX126x-family chips (SX1262, SX1268, LLCC68, STM32WLx).
// Warm sleep powers down analog, Calibrate(0x7F) refreshes ADC/PLL/image calibration,
// then re-applies RX settings that calibration may reset.
// RadioLib 7.7.0+ provides resetAGC(): warm sleep powers down analog, Calibrate(0x7F)
// refreshes ADC/PLL/image calibration, image is re-calibrated for the operating
// frequency, and DIO2 RF switch / RX boosted gain are re-applied automatically.
inline void sx126xResetAGC(SX126x* radio) {
radio->sleep(true);
radio->standby(RADIOLIB_SX126X_STANDBY_RC, true);
radio->resetAGC();
uint8_t calData = RADIOLIB_SX126X_CALIBRATE_ALL;
radio->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_CALIBRATE, &calData, 1, true, false);
radio->mod->hal->delay(5);
uint32_t start = millis();
while (radio->mod->hal->digitalRead(radio->mod->getGpio())) {
if (millis() - start > 50) break;
radio->mod->hal->yield();
}
// Calibrate(0x7F) defaults image calibration to 902-928MHz band.
// Re-calibrate for the actual operating frequency.
radio->calibrateImage(radio->freqMHz);
#ifdef SX126X_DIO2_AS_RF_SWITCH
radio->setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
#endif
#ifdef SX126X_RX_BOOSTED_GAIN
radio->setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN);
#endif
#ifdef SX126X_REGISTER_PATCH
// for improved RX with Heltec v4 — calibration may reset this
uint8_t r_data = 0;
radio->readRegister(0x8B5, &r_data, 1);
r_data |= 0x01;

14
variants/ebyte_eora_s3/target.cpp

@ -30,15 +30,23 @@ bool radio_init() {
rtc_clock.begin(Wire);
#ifdef SX126X_DIO3_TCXO_VOLTAGE
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
radio.tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE;
#else
float tcxo = 1.6f;
radio.tcxoVoltage = 1.6f;
#endif
#if defined(P_LORA_SCLK)
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
#endif
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
ConfigLoRa_t cfg;
cfg.frequency = LORA_FREQ;
cfg.bandwidth = LORA_BW;
cfg.spreadingFactor = LORA_SF;
cfg.codingRate = LORA_CR;
cfg.syncWord = RADIOLIB_LORA_SYNC_WORD_PRIVATE;
cfg.power = LORA_TX_POWER;
cfg.preambleLength = 8;
int status = radio.begin(cfg);
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");
Serial.println(status);

14
variants/minewsemi_me25ls01/target.cpp

@ -51,14 +51,22 @@ bool radio_init() {
//rtc_clock.begin(Wire);
#ifdef LR11X0_DIO3_TCXO_VOLTAGE
float tcxo = LR11X0_DIO3_TCXO_VOLTAGE;
radio.tcxoVoltage = LR11X0_DIO3_TCXO_VOLTAGE;
#else
float tcxo = 1.6f;
radio.tcxoVoltage = 1.6f;
#endif
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
SPI.begin();
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE, LORA_TX_POWER, 16, tcxo);
ConfigLoRa_t cfg;
cfg.frequency = LORA_FREQ;
cfg.bandwidth = LORA_BW;
cfg.spreadingFactor = LORA_SF;
cfg.codingRate = LORA_CR;
cfg.syncWord = RADIOLIB_LORA_SYNC_WORD_PRIVATE;
cfg.power = LORA_TX_POWER;
cfg.preambleLength = 16;
int status = radio.begin(cfg);
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");
Serial.println(status);

11
variants/rak3x72/target.cpp

@ -38,7 +38,16 @@ bool radio_init() {
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, 16, STM32WL_TCXO_VOLTAGE, 0);
radio.tcxoVoltage = STM32WL_TCXO_VOLTAGE;
ConfigLoRa_t cfg;
cfg.frequency = LORA_FREQ;
cfg.bandwidth = LORA_BW;
cfg.spreadingFactor = LORA_SF;
cfg.codingRate = LORA_CR;
cfg.syncWord = RADIOLIB_LORA_SYNC_WORD_PRIVATE;
cfg.power = LORA_TX_POWER;
cfg.preambleLength = 16;
int status = radio.begin(cfg);
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");

14
variants/t1000-e/target.cpp

@ -47,14 +47,22 @@ bool radio_init() {
//rtc_clock.begin(Wire);
#ifdef LR11X0_DIO3_TCXO_VOLTAGE
float tcxo = LR11X0_DIO3_TCXO_VOLTAGE;
radio.tcxoVoltage = LR11X0_DIO3_TCXO_VOLTAGE;
#else
float tcxo = 1.6f;
radio.tcxoVoltage = 1.6f;
#endif
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
SPI.begin();
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE, LORA_TX_POWER, 16, tcxo);
ConfigLoRa_t cfg;
cfg.frequency = LORA_FREQ;
cfg.bandwidth = LORA_BW;
cfg.spreadingFactor = LORA_SF;
cfg.codingRate = LORA_CR;
cfg.syncWord = RADIOLIB_LORA_SYNC_WORD_PRIVATE;
cfg.power = LORA_TX_POWER;
cfg.preambleLength = 16;
int status = radio.begin(cfg);
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");
Serial.println(status);

14
variants/thinknode_m3/target.cpp

@ -51,14 +51,22 @@ bool radio_init() {
rtc_clock.begin(Wire);
#ifdef LR11X0_DIO3_TCXO_VOLTAGE
float tcxo = LR11X0_DIO3_TCXO_VOLTAGE;
radio.tcxoVoltage = LR11X0_DIO3_TCXO_VOLTAGE;
#else
float tcxo = 1.6f;
radio.tcxoVoltage = 1.6f;
#endif
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
SPI.begin();
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE, LORA_TX_POWER, 16, tcxo);
ConfigLoRa_t cfg;
cfg.frequency = LORA_FREQ;
cfg.bandwidth = LORA_BW;
cfg.spreadingFactor = LORA_SF;
cfg.codingRate = LORA_CR;
cfg.syncWord = RADIOLIB_LORA_SYNC_WORD_PRIVATE;
cfg.power = LORA_TX_POWER;
cfg.preambleLength = 16;
int status = radio.begin(cfg);
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");
Serial.println(status);

12
variants/tiny_relay/target.cpp

@ -39,8 +39,16 @@ bool radio_init()
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, 16,
STM32WL_TCXO_VOLTAGE, 0);
radio.tcxoVoltage = STM32WL_TCXO_VOLTAGE;
ConfigLoRa_t cfg;
cfg.frequency = LORA_FREQ;
cfg.bandwidth = LORA_BW;
cfg.spreadingFactor = LORA_SF;
cfg.codingRate = LORA_CR;
cfg.syncWord = RADIOLIB_LORA_SYNC_WORD_PRIVATE;
cfg.power = LORA_TX_POWER;
cfg.preambleLength = 16;
int status = radio.begin(cfg);
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");

11
variants/wio-e5-dev/target.cpp

@ -35,7 +35,16 @@ bool radio_init() {
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, 16, 1.7, 0);
radio.tcxoVoltage = 1.7f;
ConfigLoRa_t cfg;
cfg.frequency = LORA_FREQ;
cfg.bandwidth = LORA_BW;
cfg.spreadingFactor = LORA_SF;
cfg.codingRate = LORA_CR;
cfg.syncWord = RADIOLIB_LORA_SYNC_WORD_PRIVATE;
cfg.power = LORA_TX_POWER;
cfg.preambleLength = 16;
int status = radio.begin(cfg);
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");

11
variants/wio-e5-mini/target.cpp

@ -33,7 +33,16 @@ bool radio_init() {
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, 16, 1.7, 0);
radio.tcxoVoltage = 1.7f;
ConfigLoRa_t cfg;
cfg.frequency = LORA_FREQ;
cfg.bandwidth = LORA_BW;
cfg.spreadingFactor = LORA_SF;
cfg.codingRate = LORA_CR;
cfg.syncWord = RADIOLIB_LORA_SYNC_WORD_PRIVATE;
cfg.power = LORA_TX_POWER;
cfg.preambleLength = 16;
int status = radio.begin(cfg);
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");

16
variants/wio_wm1110/target.cpp

@ -41,15 +41,23 @@ bool radio_init() {
board.enableSensorPower(true);
#ifdef LR11X0_DIO3_TCXO_VOLTAGE
float tcxo = LR11X0_DIO3_TCXO_VOLTAGE;
radio.tcxoVoltage = LR11X0_DIO3_TCXO_VOLTAGE;
#else
float tcxo = 1.8f;
radio.tcxoVoltage = 1.8f;
#endif
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
SPI.begin();
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE, LORA_TX_POWER, 16, tcxo);
ConfigLoRa_t cfg;
cfg.frequency = LORA_FREQ;
cfg.bandwidth = LORA_BW;
cfg.spreadingFactor = LORA_SF;
cfg.codingRate = LORA_CR;
cfg.syncWord = RADIOLIB_LORA_SYNC_WORD_PRIVATE;
cfg.power = LORA_TX_POWER;
cfg.preambleLength = 16;
int status = radio.begin(cfg);
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");
Serial.println(status);

Loading…
Cancel
Save