mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Merge branch 'dev' into dev-heltec-v4.3
This commit is contained in:
commit
8769c4b876
32 changed files with 192 additions and 46 deletions
|
|
@ -32,6 +32,11 @@ build_flags =
|
|||
-D PIN_TFT_LEDA_CTL=21 ; LEDK (switches on/off via mosfet to create the ground)
|
||||
-D PIN_GPS_RX=33
|
||||
-D PIN_GPS_TX=34
|
||||
-D PIN_GPS_EN=35 ; N-ch MOSFET Q2 drives P-ch high-side switch → active HIGH (default)
|
||||
-D PIN_GPS_RESET=36
|
||||
-D PIN_GPS_RESET_ACTIVE=LOW
|
||||
-D GPS_BAUD_RATE=115200
|
||||
-D ENV_INCLUDE_GPS=1
|
||||
-D SX126X_DIO2_AS_RF_SWITCH=true
|
||||
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
|
||||
-D SX126X_CURRENT_LIMIT=140
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ WRAPPER_CLASS radio_driver(radio, board);
|
|||
|
||||
ESP32RTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
||||
// GPS_EN (GPIO35) drives N-ch MOSFET → P-ch high-side switch; GPS_RESET (GPIO36) active LOW
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock, GPS_RESET, GPS_EN, &board.periph_power);
|
||||
HWTSensorManager sensors = HWTSensorManager(nmea);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
|
|
@ -58,18 +59,16 @@ mesh::LocalIdentity radio_new_identity() {
|
|||
|
||||
void HWTSensorManager::start_gps() {
|
||||
if (!gps_active) {
|
||||
board.periph_power.claim();
|
||||
|
||||
_location->begin(); // Claims periph_power via RefCountedDigitalPin
|
||||
gps_active = true;
|
||||
Serial1.println("$CFGSYS,h35155*68");
|
||||
Serial1.println("$CFGSYS,h35155*68"); // Configure GPS for all constellations
|
||||
}
|
||||
}
|
||||
|
||||
void HWTSensorManager::stop_gps() {
|
||||
if (gps_active) {
|
||||
gps_active = false;
|
||||
|
||||
board.periph_power.release();
|
||||
_location->stop(); // Releases periph_power via RefCountedDigitalPin
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public:
|
|||
const char* getSettingName(int i) const override;
|
||||
const char* getSettingValue(int i) const override;
|
||||
bool setSettingValue(const char* name, const char* value) override;
|
||||
LocationProvider* getLocationProvider() override { return _location; }
|
||||
};
|
||||
|
||||
extern HeltecV3Board board;
|
||||
|
|
|
|||
|
|
@ -6,18 +6,26 @@ void HeltecTrackerV2Board::begin() {
|
|||
pinMode(PIN_ADC_CTRL, OUTPUT);
|
||||
digitalWrite(PIN_ADC_CTRL, LOW); // Initially inactive
|
||||
|
||||
// Set up digital GPIO registers before releasing RTC hold. The hold latches
|
||||
// the pad state including function select, so register writes accumulate
|
||||
// without affecting the pad. On hold release, all changes apply atomically
|
||||
// (IO MUX switches to digital GPIO with output already HIGH — no glitch).
|
||||
pinMode(P_LORA_PA_POWER, OUTPUT);
|
||||
digitalWrite(P_LORA_PA_POWER,HIGH);
|
||||
rtc_gpio_hold_dis((gpio_num_t)P_LORA_PA_POWER);
|
||||
|
||||
rtc_gpio_hold_dis((gpio_num_t)P_LORA_PA_EN);
|
||||
pinMode(P_LORA_PA_EN, OUTPUT);
|
||||
digitalWrite(P_LORA_PA_EN,HIGH);
|
||||
rtc_gpio_hold_dis((gpio_num_t)P_LORA_PA_EN);
|
||||
pinMode(P_LORA_PA_TX_EN, OUTPUT);
|
||||
digitalWrite(P_LORA_PA_TX_EN,LOW);
|
||||
|
||||
periph_power.begin();
|
||||
|
||||
esp_reset_reason_t reason = esp_reset_reason();
|
||||
if (reason != ESP_RST_DEEPSLEEP) {
|
||||
delay(1); // GC1109 startup time after cold power-on
|
||||
}
|
||||
|
||||
periph_power.begin();
|
||||
if (reason == ESP_RST_DEEPSLEEP) {
|
||||
long wakeup_source = esp_sleep_get_ext1_wakeup_status();
|
||||
if (wakeup_source & (1 << P_LORA_DIO_1)) { // received a LoRa packet (while in deep sleep)
|
||||
|
|
@ -48,7 +56,9 @@ void HeltecTrackerV2Board::begin() {
|
|||
|
||||
rtc_gpio_hold_en((gpio_num_t)P_LORA_NSS);
|
||||
|
||||
rtc_gpio_hold_en((gpio_num_t)P_LORA_PA_EN); //It also needs to be enabled in receive mode
|
||||
// Hold GC1109 FEM pins during sleep to keep LNA active for RX wake
|
||||
rtc_gpio_hold_en((gpio_num_t)P_LORA_PA_POWER);
|
||||
rtc_gpio_hold_en((gpio_num_t)P_LORA_PA_EN);
|
||||
|
||||
if (pin_wake_btn < 0) {
|
||||
esp_sleep_enable_ext1_wakeup( (1L << P_LORA_DIO_1), ESP_EXT1_WAKEUP_ANY_HIGH); // wake up on: recv LoRa packet
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@ build_flags =
|
|||
-D P_LORA_SCLK=9
|
||||
-D P_LORA_MISO=11
|
||||
-D P_LORA_MOSI=10
|
||||
-D P_LORA_PA_POWER=7 ;power en
|
||||
-D P_LORA_PA_EN=4
|
||||
-D P_LORA_PA_TX_EN=46 ;enable tx
|
||||
-D LORA_TX_POWER=10 ;If it is configured as 10 here, the final output will be 22 dbm.
|
||||
-D MAX_LORA_TX_POWER=22 ;Max SX1262 output
|
||||
-D P_LORA_PA_POWER=7 ; VFEM_Ctrl - GC1109 LDO power enable
|
||||
-D P_LORA_PA_EN=4 ; CSD - GC1109 chip enable (HIGH=on)
|
||||
-D P_LORA_PA_TX_EN=46 ; CPS - GC1109 PA mode (HIGH=full PA, LOW=bypass)
|
||||
-D LORA_TX_POWER=10 ; 10dBm + ~11dB GC1109 gain = ~21dBm output
|
||||
-D MAX_LORA_TX_POWER=22 ; Max SX1262 output -> ~28dBm at antenna
|
||||
-D SX126X_DIO2_AS_RF_SWITCH=true
|
||||
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
|
||||
-D SX126X_CURRENT_LIMIT=140
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ void HeltecV4Board::begin() {
|
|||
loRaFEMControl.init();
|
||||
|
||||
periph_power.begin();
|
||||
|
||||
esp_reset_reason_t reason = esp_reset_reason();
|
||||
if (reason == ESP_RST_DEEPSLEEP) {
|
||||
long wakeup_source = esp_sleep_get_ext1_wakeup_status();
|
||||
if (wakeup_source & (1 << P_LORA_DIO_1)) { // received a LoRa packet (while in deep sleep)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ build_flags =
|
|||
-D P_LORA_KCT8103L_PA_CTX=5
|
||||
-D PIN_USER_BTN=0
|
||||
-D PIN_VEXT_EN=36
|
||||
-D PIN_VEXT_EN_ACTIVE=LOW
|
||||
-D PIN_VEXT_EN_ACTIVE=HIGH
|
||||
-D LORA_TX_POWER=10 ;If it is configured as 10 here, the final output will be 22 dbm.
|
||||
-D MAX_LORA_TX_POWER=22 ; Max SX1262 output
|
||||
-D SX126X_REGISTER_PATCH=1 ; Patch register 0x8B5 for improved RX
|
||||
|
|
@ -56,8 +56,6 @@ build_flags =
|
|||
-D PIN_BOARD_SDA=17
|
||||
-D PIN_BOARD_SCL=18
|
||||
-D PIN_OLED_RESET=21
|
||||
-D ENV_PIN_SDA=4
|
||||
-D ENV_PIN_SCL=3
|
||||
build_src_filter= ${Heltec_lora32_v4.build_src_filter}
|
||||
lib_deps = ${Heltec_lora32_v4.lib_deps}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|||
#endif
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
DISPLAY_CLASS display(&(board.periph_power));
|
||||
DISPLAY_CLASS display(NULL);
|
||||
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -20,13 +20,29 @@ void RAK3401Board::begin() {
|
|||
|
||||
Wire.begin();
|
||||
|
||||
// PIN_3V3_EN (WB_IO2, P0.34) controls the 3V3_S switched peripheral rail
|
||||
// AND the 5V boost regulator (U5) on the RAK13302 that powers the SKY66122 PA.
|
||||
// Must stay HIGH during radio operation — do not toggle for power saving.
|
||||
pinMode(PIN_3V3_EN, OUTPUT);
|
||||
digitalWrite(PIN_3V3_EN, HIGH);
|
||||
|
||||
#ifdef P_LORA_PA_EN
|
||||
// Initialize RAK13302 1W LoRa transceiver module PA control pin
|
||||
pinMode(P_LORA_PA_EN, OUTPUT);
|
||||
digitalWrite(P_LORA_PA_EN, LOW); // Start with PA disabled
|
||||
delay(10); // Allow PA module to initialize
|
||||
// Enable SKY66122-11 FEM on the RAK13302 module.
|
||||
// CSD and CPS are tied together on the RAK13302 PCB, routed to IO3 (P0.21).
|
||||
// HIGH = FEM active (LNA for RX, PA path available for TX).
|
||||
// TX/RX switching (CTX) is handled by SX1262 DIO2 via SetDIO2AsRfSwitchCtrl.
|
||||
pinMode(SX126X_POWER_EN, OUTPUT);
|
||||
digitalWrite(SX126X_POWER_EN, HIGH);
|
||||
delay(1); // SKY66122 turn-on settling time (tON = 3us typ)
|
||||
}
|
||||
|
||||
#ifdef NRF52_POWER_MANAGEMENT
|
||||
void RAK3401Board::initiateShutdown(uint8_t reason) {
|
||||
// Disable SKY66122 FEM (CSD+CPS LOW = shutdown, <1 uA)
|
||||
digitalWrite(SX126X_POWER_EN, LOW);
|
||||
|
||||
// Disable 3V3 switched peripherals and 5V boost
|
||||
digitalWrite(PIN_3V3_EN, LOW);
|
||||
|
||||
enterSystemOff(reason);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -38,13 +38,6 @@ public:
|
|||
return "RAK 3401";
|
||||
}
|
||||
|
||||
#ifdef P_LORA_PA_EN
|
||||
void onBeforeTransmit() override {
|
||||
digitalWrite(P_LORA_PA_EN, HIGH); // Enable PA before transmission
|
||||
}
|
||||
|
||||
void onAfterTransmit() override {
|
||||
digitalWrite(P_LORA_PA_EN, LOW); // Disable PA after transmission to save power
|
||||
}
|
||||
#endif
|
||||
// TX/RX switching is handled by SX1262 DIO2 -> SKY66122 CTX (hardware-timed).
|
||||
// No onBeforeTransmit/onAfterTransmit overrides needed.
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ build_flags = ${nrf52_base.build_flags}
|
|||
-D LORA_TX_POWER=22
|
||||
-D SX126X_CURRENT_LIMIT=140
|
||||
-D SX126X_RX_BOOSTED_GAIN=1
|
||||
-D SX126X_REGISTER_PATCH=1 ; Patch register 0x8B5 for improved RX with SKY66122 FEM
|
||||
build_src_filter = ${nrf52_base.build_src_filter}
|
||||
+<../variants/rak3401>
|
||||
+<helpers/sensors>
|
||||
|
|
|
|||
|
|
@ -147,8 +147,15 @@ static const uint8_t AREF = PIN_AREF;
|
|||
#define SX126X_BUSY (9)
|
||||
#define SX126X_RESET (4)
|
||||
|
||||
#define SX126X_POWER_EN (21)
|
||||
// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
|
||||
// SKY66122-11 FEM control on the RAK13302 module:
|
||||
// CSD + CPS are tied together on the PCB, routed to WisBlock IO3 (P0.21).
|
||||
// Setting IO3 HIGH enables the FEM (LNA for RX, PA path for TX).
|
||||
// CTX is connected to SX1262 DIO2 — the radio handles TX/RX switching
|
||||
// in hardware via SetDIO2AsRfSwitchCtrl (microsecond-accurate, no GPIO needed).
|
||||
// The 5V boost for the PA is enabled by WB_IO2 (P0.34 = PIN_3V3_EN).
|
||||
#define SX126X_POWER_EN (21) // P0.21 = IO3 -> SKY66122 CSD+CPS (FEM enable)
|
||||
|
||||
// CTX is driven by SX1262 DIO2, not a GPIO
|
||||
#define SX126X_DIO2_AS_RF_SWITCH
|
||||
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
||||
|
||||
|
|
@ -159,7 +166,6 @@ static const uint8_t AREF = PIN_AREF;
|
|||
#define P_LORA_DIO_1 SX126X_DIO1
|
||||
#define P_LORA_BUSY SX126X_BUSY
|
||||
#define P_LORA_RESET SX126X_RESET
|
||||
#define P_LORA_PA_EN 31
|
||||
|
||||
// enables 3.3V periphery like GPS or IO Module
|
||||
// Do not toggle this for GPS power savings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue