Merge pull request #1836 from weebl2000/fix-rak3401-sky66122-11-fem
Fix RAK3401 SKY66122-11 FEM control: enable CSD/CPS for proper PA/LNA operation
This commit is contained in:
@@ -20,13 +20,29 @@ void RAK3401Board::begin() {
|
|||||||
|
|
||||||
Wire.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);
|
pinMode(PIN_3V3_EN, OUTPUT);
|
||||||
digitalWrite(PIN_3V3_EN, HIGH);
|
digitalWrite(PIN_3V3_EN, HIGH);
|
||||||
|
|
||||||
#ifdef P_LORA_PA_EN
|
// Enable SKY66122-11 FEM on the RAK13302 module.
|
||||||
// Initialize RAK13302 1W LoRa transceiver module PA control pin
|
// CSD and CPS are tied together on the RAK13302 PCB, routed to IO3 (P0.21).
|
||||||
pinMode(P_LORA_PA_EN, OUTPUT);
|
// HIGH = FEM active (LNA for RX, PA path available for TX).
|
||||||
digitalWrite(P_LORA_PA_EN, LOW); // Start with PA disabled
|
// TX/RX switching (CTX) is handled by SX1262 DIO2 via SetDIO2AsRfSwitchCtrl.
|
||||||
delay(10); // Allow PA module to initialize
|
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
|
#endif
|
||||||
}
|
|
||||||
@@ -38,13 +38,6 @@ public:
|
|||||||
return "RAK 3401";
|
return "RAK 3401";
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef P_LORA_PA_EN
|
// TX/RX switching is handled by SX1262 DIO2 -> SKY66122 CTX (hardware-timed).
|
||||||
void onBeforeTransmit() override {
|
// No onBeforeTransmit/onAfterTransmit overrides needed.
|
||||||
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
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ build_flags = ${nrf52_base.build_flags}
|
|||||||
-D LORA_TX_POWER=22
|
-D LORA_TX_POWER=22
|
||||||
-D SX126X_CURRENT_LIMIT=140
|
-D SX126X_CURRENT_LIMIT=140
|
||||||
-D SX126X_RX_BOOSTED_GAIN=1
|
-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}
|
build_src_filter = ${nrf52_base.build_src_filter}
|
||||||
+<../variants/rak3401>
|
+<../variants/rak3401>
|
||||||
+<helpers/sensors>
|
+<helpers/sensors>
|
||||||
|
|||||||
@@ -147,8 +147,15 @@ static const uint8_t AREF = PIN_AREF;
|
|||||||
#define SX126X_BUSY (9)
|
#define SX126X_BUSY (9)
|
||||||
#define SX126X_RESET (4)
|
#define SX126X_RESET (4)
|
||||||
|
|
||||||
#define SX126X_POWER_EN (21)
|
// SKY66122-11 FEM control on the RAK13302 module:
|
||||||
// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
|
// 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_DIO2_AS_RF_SWITCH
|
||||||
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
#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_DIO_1 SX126X_DIO1
|
||||||
#define P_LORA_BUSY SX126X_BUSY
|
#define P_LORA_BUSY SX126X_BUSY
|
||||||
#define P_LORA_RESET SX126X_RESET
|
#define P_LORA_RESET SX126X_RESET
|
||||||
#define P_LORA_PA_EN 31
|
|
||||||
|
|
||||||
// enables 3.3V periphery like GPS or IO Module
|
// enables 3.3V periphery like GPS or IO Module
|
||||||
// Do not toggle this for GPS power savings
|
// Do not toggle this for GPS power savings
|
||||||
|
|||||||
Reference in New Issue
Block a user