Fix RAK3401 SKY66122-11 FEM control: enable CSD/CPS for proper PA and LNA operation

The RAK13302 1W module uses a Skyworks SKY66122-11 front-end module with
three digital control pins (CSD, CTX, CPS) that must be actively driven
by the host MCU. The previous code only managed CTX (GPIO 31) — toggling
it for TX/RX — but never initialized CSD (GPIO 24) or CPS (GPIO 21),
leaving them floating with no pull-up/pull-down resistors on the PCB.

With floating CSD and CPS, the SKY66122 was in an undefined operating
mode:
- The 30 dB TX PA may not have been reliably engaging
- The 16 dB RX LNA was never reliably active, degrading receive
sensitivity
This commit is contained in:
Wessel Nieboer
2026-02-25 00:26:38 +01:00
parent 06ab9f7f6b
commit 70f1ad4aeb
3 changed files with 41 additions and 12 deletions

View File

@@ -38,13 +38,14 @@ public:
return "RAK 3401";
}
#ifdef P_LORA_PA_EN
// SKY66122 FEM TX/RX switching via CTX pin.
// CTX=HIGH: TX mode + 5V boost ON (PA powered from VCC1/VCC2)
// CTX=LOW: RX mode + 5V boost OFF (LNA powered from VSUP1 at 3.3V)
void onBeforeTransmit() override {
digitalWrite(P_LORA_PA_EN, HIGH); // Enable PA before transmission
digitalWrite(P_LORA_PA_EN, HIGH); // CTX=1: TX mode, boost on
}
void onAfterTransmit() override {
digitalWrite(P_LORA_PA_EN, LOW); // Disable PA after transmission to save power
digitalWrite(P_LORA_PA_EN, LOW); // CTX=0: RX mode, boost off
}
#endif
};