sforkowany z mirror/meshtastic-firmware
RAK815 lora works
rodzic
0b5b18653a
commit
e12c057c31
|
@ -2,6 +2,9 @@
|
|||
|
||||
## RAK815
|
||||
|
||||
TODO:
|
||||
This board has a TCXO, which is uncommon. For better RF performance it should be enabled P0.05 (RF95_TCXO) high. And then tell the RF95 to use it.
|
||||
|
||||
### Bootloader
|
||||
|
||||
Install our (temporarily hacked up) adafruit bootloader
|
||||
|
@ -36,6 +39,7 @@ Run.
|
|||
tips on installing https://github.com/platformio/platform-nordicnrf52/issues/8#issuecomment-374017768
|
||||
|
||||
to see console output over jlink:
|
||||
|
||||
```
|
||||
12:17
|
||||
in one tab run "bin/nrf52832-gdbserver.sh" - leave this running the whole time while developing/debugging
|
||||
|
|
|
@ -56,7 +56,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define optstr(s) (xstr(s)[0] ? xstr(s) : "unset")
|
||||
|
||||
#ifdef NRF52_SERIES // All of the NRF52 targets are configured using variant.h, so this section shouldn't need to be
|
||||
// board specific
|
||||
// board specific
|
||||
|
||||
//
|
||||
// Standard definitions for NRF52 targets
|
||||
|
@ -78,7 +78,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// If the variant filed defines as standard button
|
||||
#ifdef PIN_BUTTON1
|
||||
#define BUTTON_PIN PIN_BUTTON1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// FIXME, use variant.h defs for all of this!!! (even on the ESP32 targets)
|
||||
#elif defined(CubeCell_BoardPlus)
|
||||
|
@ -113,10 +113,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// LoRa SPI
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// NRF52 boards will define this in variant.h
|
||||
#ifndef RF95_SCK
|
||||
#define RF95_SCK 5
|
||||
#define RF95_MISO 19
|
||||
#define RF95_MOSI 27
|
||||
#define RF95_NSS 18
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -159,8 +162,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define RF95_RESET 14
|
||||
#endif
|
||||
#define RF95_IRQ 26
|
||||
#define DIO1_GPIO 33 // Note: not really used on this board
|
||||
#define DIO2_GPIO 32 // Note: not really used on this board
|
||||
#define RF95_DIO1 33 // Note: not really used on this board
|
||||
#define RF95_DIO2 32 // Note: not really used on this board
|
||||
|
||||
// Leave undefined to disable our PMU IRQ handler
|
||||
#define PMU_IRQ 35
|
||||
|
@ -179,11 +182,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define BUTTON_PIN 39
|
||||
|
||||
#ifndef USE_JTAG
|
||||
#define RESET_GPIO 23
|
||||
#define RF95_RESET 23
|
||||
#endif
|
||||
#define RF95_IRQ_GPIO 26
|
||||
#define DIO1_GPIO 33 // Note: not really used on this board
|
||||
#define DIO2_GPIO 32 // Note: not really used on this board
|
||||
#define RF95_IRQ 26
|
||||
#define RF95_DIO1 33 // Note: not really used on this board
|
||||
#define RF95_DIO2 32 // Note: not really used on this board
|
||||
|
||||
// This board has different GPS pins than all other boards
|
||||
#undef GPS_RX_PIN
|
||||
|
@ -214,11 +217,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define BUTTON_PIN 0 // If defined, this will be used for user button presses
|
||||
|
||||
#ifndef USE_JTAG
|
||||
#define RESET_GPIO 14 // If defined, this pin will be used to reset the LORA radio
|
||||
#define RF95_RESET 14 // If defined, this pin will be used to reset the LORA radio
|
||||
#endif
|
||||
#define RF95_IRQ_GPIO 26
|
||||
#define DIO1_GPIO 35 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number
|
||||
#define DIO2_GPIO 34 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number
|
||||
#define RF95_IRQ 26
|
||||
#define RF95_DIO1 35 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number
|
||||
#define RF95_DIO2 34 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number
|
||||
#elif defined(TTGO_LORA_V1)
|
||||
// This string must exactly match the case used in release file names or the android updater won't work
|
||||
#define HW_VENDOR "ttgo-lora32-v1"
|
||||
|
@ -236,10 +239,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define LED_PIN 2 // If defined we will blink this LED
|
||||
#define BUTTON_PIN 0 // If defined, this will be used for user button presses
|
||||
|
||||
#define RESET_GPIO 14 // If defined, this pin will be used to reset the LORA radio
|
||||
#define RF95_IRQ_GPIO 26 // IRQ line for the LORA radio
|
||||
#define DIO1_GPIO 35 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number
|
||||
#define DIO2_GPIO 34 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number
|
||||
#define RF95_RESET 14 // If defined, this pin will be used to reset the LORA radio
|
||||
#define RF95_IRQ 26 // IRQ line for the LORA radio
|
||||
#define RF95_DIO1 35 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number
|
||||
#define RF95_DIO2 34 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number
|
||||
#elif defined(TTGO_LORA_V2)
|
||||
// This string must exactly match the case used in release file names or the android updater won't work
|
||||
#define HW_VENDOR "ttgo-lora32-v2"
|
||||
|
@ -260,10 +263,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
0 // If defined, this will be used for user button presses, if your board doesn't have a physical switch, you can wire one
|
||||
// between this pin and ground
|
||||
|
||||
#define RESET_GPIO 14 // If defined, this pin will be used to reset the LORA radio
|
||||
#define RF95_IRQ_GPIO 26 // IRQ line for the LORA radio
|
||||
#define DIO1_GPIO 35 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number
|
||||
#define DIO2_GPIO 34 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number
|
||||
#define RF95_RESET 14 // If defined, this pin will be used to reset the LORA radio
|
||||
#define RF95_IRQ 26 // IRQ line for the LORA radio
|
||||
#define RF95_DIO1 35 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number
|
||||
#define RF95_DIO2 34 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number
|
||||
#endif
|
||||
|
||||
#ifdef ARDUINO_NRF52840_PCA10056
|
||||
|
@ -275,14 +278,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#undef LED_INVERTED
|
||||
#define LED_INVERTED 1
|
||||
|
||||
// Uncomment to confirm if we can build the RF95 driver for NRF52
|
||||
#if 0
|
||||
#define RESET_GPIO 14 // If defined, this pin will be used to reset the LORA radio
|
||||
#define RF95_IRQ_GPIO 26 // IRQ line for the LORA radio
|
||||
#define DIO1_GPIO 35 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number
|
||||
#define DIO2_GPIO 34 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number
|
||||
#endif
|
||||
|
||||
#elif defined(ARDUINO_NRF52840_PPR)
|
||||
|
||||
#define HW_VENDOR "ppr"
|
||||
|
@ -301,7 +296,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define SERIAL_BAUD CONSOLE_MAX_BAUD
|
||||
#else
|
||||
#define SERIAL_BAUD 921600 // Serial debug baud rate
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "SerialConsole.h"
|
||||
|
||||
|
@ -314,7 +309,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#ifndef PIN_SERIAL_RX
|
||||
// No serial ports on this board - use segger in memory console
|
||||
#define USE_SEGGER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define SERIAL0_RX_GPIO 3 // Always GPIO3 on ESP32
|
||||
|
|
|
@ -267,7 +267,7 @@ void setup()
|
|||
if (!gps->setup()) {
|
||||
DEBUG_MSG("ERROR: No UBLOX GPS found\n");
|
||||
|
||||
if(GPS::_serial_gps) {
|
||||
if (GPS::_serial_gps) {
|
||||
// Some boards might have only the TX line from the GPS connected, in that case, we can't configure it at all. Just
|
||||
// assume NEMA at 9600 baud.
|
||||
DEBUG_MSG("Hoping that NEMA might work\n");
|
||||
|
@ -308,7 +308,7 @@ void setup()
|
|||
|
||||
// MUST BE AFTER service.init, so we have our radio config settings (from nodedb init)
|
||||
RadioInterface *rIf =
|
||||
#if defined(RF95_IRQ_GPIO)
|
||||
#if defined(RF95_IRQ)
|
||||
// new CustomRF95(); old Radiohead based driver
|
||||
new RF95Interface(RF95_NSS, RF95_IRQ, RF95_RESET, SPI);
|
||||
#elif defined(SX1262_CS)
|
||||
|
|
|
@ -24,8 +24,14 @@ bool RF95Interface::init()
|
|||
power = MAX_POWER;
|
||||
|
||||
iface = lora = new RadioLibRF95(&module);
|
||||
|
||||
#ifdef RF95_TCXO
|
||||
pinMode(RF95_TCXO, OUTPUT);
|
||||
digitalWrite(RF95_TCXO, 1);
|
||||
#endif
|
||||
|
||||
int res = lora->begin(freq, bw, sf, cr, syncWord, power, currentLimit, preambleLength);
|
||||
DEBUG_MSG("LORA init result %d\n", res);
|
||||
DEBUG_MSG("RF95 init result %d\n", res);
|
||||
|
||||
if (res == ERR_NONE)
|
||||
res = lora->setCRC(SX126X_LORA_CRC_ON);
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
#define RF95_CHIP_VERSION 0x12
|
||||
#define RF95_ALT_VERSION 0x11 // Supposedly some versions of the chip have id 0x11
|
||||
|
||||
// From datasheet but radiolib doesn't know anything about this
|
||||
#define SX127X_REG_TCXO 0x4B
|
||||
|
||||
|
||||
RadioLibRF95::RadioLibRF95(Module *mod) : SX1278(mod) {}
|
||||
|
||||
int16_t RadioLibRF95::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint8_t currentLimit,
|
||||
|
@ -18,6 +22,11 @@ int16_t RadioLibRF95::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_
|
|||
state = config();
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
#ifdef RF95_TCXO
|
||||
state = _mod->SPIsetRegValue(SX127X_REG_TCXO, 0x10 | _mod->SPIgetRegValue(SX127X_REG_TCXO));
|
||||
RADIOLIB_ASSERT(state);
|
||||
#endif
|
||||
|
||||
// configure publicly accessible settings
|
||||
state = setFrequency(freq);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
|
|
@ -33,7 +33,7 @@ bool SX1262Interface::init()
|
|||
if (power > 22) // This chip has lower power limits than some
|
||||
power = 22;
|
||||
int res = lora.begin(freq, bw, sf, cr, syncWord, power, currentLimit, preambleLength, tcxoVoltage, useRegulatorLDO);
|
||||
DEBUG_MSG("LORA init result %d\n", res);
|
||||
DEBUG_MSG("SX1262 init result %d\n", res);
|
||||
|
||||
#ifdef SX1262_TXEN
|
||||
// lora.begin sets Dio2 as RF switch control, which is not true if we are manually controlling RX and TX
|
||||
|
|
|
@ -52,8 +52,9 @@ void setBluetoothEnable(bool on)
|
|||
if (on != bleOn) {
|
||||
if (on) {
|
||||
if (!nrf52Bluetooth) {
|
||||
nrf52Bluetooth = new NRF52Bluetooth();
|
||||
nrf52Bluetooth->setup();
|
||||
DEBUG_MSG("DISABLING NRF52 BLUETOOTH WHILE DEBUGGING\n");
|
||||
//nrf52Bluetooth = new NRF52Bluetooth();
|
||||
//nrf52Bluetooth->setup();
|
||||
}
|
||||
} else {
|
||||
DEBUG_MSG("FIXME: implement BLE disable\n");
|
||||
|
|
Ładowanie…
Reference in New Issue