Station G3: Detect LNA_P and PA-PL1 hardware jumper states before driving FEM GPIOs

未關閉
#3,860 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 2 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
53/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
c
領域
embedded-iot

研究方向

Start with variants/station_g3_esp32/LoRaFEMControl.cpp and inspect init(), the FEM capability methods, and the mode and gain functions named in the issue. Then check StationG3Board::handleCommand() and powerOff() to trace how unsupported controls and GPIO holds are handled. The issue describes boot-time jumper probing and the expected unsupported responses; done means jumper-shorted pins remain inputs and their radio gain controls report unsupported.

由索引模型根據 Issue 內容生成。

描述

Note: I do not use MeshCore myself—all of our testing was done with Meshtastic firmware (https://github.com/meshtastic/firmware/pull/12084) and was not tested on MeshCore, which is why I'm opening an issue rather than a PR. While cross-referencing your variants/station_g3_esp32/LoRaFEMControl.cpp implementation (#2515 / #3137), we tested hardware jumper detection on the Station G3 that may be useful here as well.

Background & Issue

On the Station G3 (BQ35LORA900V1M), software control of the primary slot LNA (P_PRIMARY_LNA_EN, GPIO 10) and PA Power Level 1 (P_PA1_EN, GPIO 9) is only possible when the physical LNA P and PA-PL1 jumpers on the baseboard are removed:

  • LNA P (GPIO 10): Active LOW (LOW/open = LNA ON, HIGH/short = LNA OFF). Installing the physical jumper shorts the line HIGH (hardware-disabling the LNA).
  • PA-PL1 (GPIO 9): Active HIGH (LOW/open = low power level, HIGH/short = high power level). Installing the physical jumper shorts the line HIGH (and the Station G3 ships with PA-PL1 installed by default).

Currently in variants/station_g3_esp32/LoRaFEMControl.cpp:

  1. LoRaFEMControl::init() unconditionally sets both P_PA1_EN and P_PRIMARY_LNA_EN to OUTPUT and drives them (LOW for P_PA1_EN when pa_gain_enabled = false, and LOW for P_PRIMARY_LNA_EN during RX/sleep)—which drives LOW directly against the HIGH jumper when a jumper is installed.
  2. canControlLNA() and canControlPAGain() unconditionally return true whenever the pin macros are defined, so get/set radio.fem.rxgain and get/set radio.fem.txgain report OK even when a physical jumper is overriding the pin in hardware.
Suggested Fix (Hardware-Verified on Station G3 with Meshtastic)

In Meshtastic firmware, we tested probing the Station G3's jumper state at boot in init() using the ESP32-S3's internal pull-down (INPUT_PULLDOWN) before configuring the pin as an OUTPUT:

  • With the jumper removed (open), digitalRead() with INPUT_PULLDOWN reads LOW (0, 0 mV).
  • With the jumper installed (shorted), digitalRead() with INPUT_PULLDOWN reads HIGH (1).

In variants/station_g3_esp32/LoRaFEMControl.cpp, init() could check each pin before driving it:

#ifdef P_PA1_EN
  rtc_gpio_hold_dis((gpio_num_t)P_PA1_EN);
  pinMode(P_PA1_EN, INPUT_PULLDOWN);
  delay(1);
  if (digitalRead(P_PA1_EN) == LOW) {
    pa_can_control = true;
    pinMode(P_PA1_EN, OUTPUT);
    applyPAGain();
  }
#endif

#ifdef P_PRIMARY_LNA_EN
  rtc_gpio_hold_dis((gpio_num_t)P_PRIMARY_LNA_EN);
  pinMode(P_PRIMARY_LNA_EN, INPUT_PULLDOWN);
  delay(1);
  if (digitalRead(P_PRIMARY_LNA_EN) == LOW) {
    lna_can_control = true;
    pinMode(P_PRIMARY_LNA_EN, OUTPUT);
    setRxModeEnable();
  }
#endif

Then:

  • Have canControlLNA() return lna_can_control and canControlPAGain() return pa_can_control (which automatically makes StationG3Board::handleCommand() return "Error: unsupported" for get/set radio.fem.rxgain or txgain when the corresponding jumper is installed).
  • Guard the digitalWrite() calls in setSleepModeEnable(), setTxModeEnable(), setRxModeEnable(), applyPAGain(), and rtc_gpio_hold_en() in StationG3Board::powerOff() with canControlLNA() / canControlPAGain() so the MCU leaves jumper-shorted pins in INPUT mode.
Reference
主要語言
C
星號
3.9k
分支
1.5k
平均合併
2 天 19 小時
30 天內合併 PR
61

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

meshcore-dev/MeshCore 的其他 Issue

查看 meshcore-dev/MeshCore 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。