@@ -7,19 +7,26 @@ void HeltecV4Board::begin() {
77 pinMode (PIN_ADC_CTRL , OUTPUT );
88 digitalWrite (PIN_ADC_CTRL , LOW ); // Initially inactive
99
10+ // Set up digital GPIO registers before releasing RTC hold. The hold latches
11+ // the pad state including function select, so register writes accumulate
12+ // without affecting the pad. On hold release, all changes apply atomically
13+ // (IO MUX switches to digital GPIO with output already HIGH — no glitch).
1014 pinMode (P_LORA_PA_POWER , OUTPUT );
1115 digitalWrite (P_LORA_PA_POWER ,HIGH );
16+ rtc_gpio_hold_dis ((gpio_num_t )P_LORA_PA_POWER );
1217
13- rtc_gpio_hold_dis ((gpio_num_t )P_LORA_PA_EN );
1418 pinMode (P_LORA_PA_EN , OUTPUT );
1519 digitalWrite (P_LORA_PA_EN ,HIGH );
20+ rtc_gpio_hold_dis ((gpio_num_t )P_LORA_PA_EN );
1621 pinMode (P_LORA_PA_TX_EN , OUTPUT );
1722 digitalWrite (P_LORA_PA_TX_EN ,LOW );
1823
24+ esp_reset_reason_t reason = esp_reset_reason ();
25+ if (reason != ESP_RST_DEEPSLEEP ) {
26+ delay (1 ); // GC1109 startup time after cold power-on
27+ }
1928
2029 periph_power.begin ();
21-
22- esp_reset_reason_t reason = esp_reset_reason ();
2330 if (reason == ESP_RST_DEEPSLEEP ) {
2431 long wakeup_source = esp_sleep_get_ext1_wakeup_status ();
2532 if (wakeup_source & (1 << P_LORA_DIO_1 )) { // received a LoRa packet (while in deep sleep)
@@ -50,7 +57,9 @@ void HeltecV4Board::begin() {
5057
5158 rtc_gpio_hold_en ((gpio_num_t )P_LORA_NSS );
5259
53- rtc_gpio_hold_en ((gpio_num_t )P_LORA_PA_EN ); // It also needs to be enabled in receive mode
60+ // Hold GC1109 FEM pins during sleep to keep LNA active for RX wake
61+ rtc_gpio_hold_en ((gpio_num_t )P_LORA_PA_POWER );
62+ rtc_gpio_hold_en ((gpio_num_t )P_LORA_PA_EN );
5463
5564 if (pin_wake_btn < 0 ) {
5665 esp_sleep_enable_ext1_wakeup ( (1L << P_LORA_DIO_1 ), ESP_EXT1_WAKEUP_ANY_HIGH ); // wake up on: recv LoRa packet
0 commit comments