diff --git a/firmware/common/rf_path.c b/firmware/common/rf_path.c index 6f1af434..4efb0ec7 100644 --- a/firmware/common/rf_path.c +++ b/firmware/common/rf_path.c @@ -79,8 +79,6 @@ SWITCHCTRL_MIX_BYPASS | SWITCHCTRL_HP | SWITCHCTRL_NO_RX_AMP_PWR) #endif -uint8_t switchctrl = SWITCHCTRL_SAFE; - /* * Antenna port power on HackRF One is controlled by GPO1 on the RFFC5072. * This is the only thing we use RFFC5072 GPO for on HackRF One. The value of @@ -267,6 +265,12 @@ void rf_path_pin_setup(rf_path_t* const rf_path) /* Configure RF power supply (VAA) switch */ scu_pinmux(SCU_NO_VAA_ENABLE, SCU_GPIO_FAST | SCU_CONF_FUNCTION0); + /* + * Safe (initial) switch settings turn off both amplifiers and antenna port + * power and enable both amp bypass and mixer bypass. + */ + switchctrl_set(rf_path, SWITCHCTRL_SAFE); + /* Configure RF switch control signals as outputs */ gpio_output(rf_path->gpio_amp_bypass); gpio_output(rf_path->gpio_no_mix_bypass); @@ -281,12 +285,6 @@ void rf_path_pin_setup(rf_path_t* const rf_path) gpio_output(rf_path->gpio_tx); gpio_output(rf_path->gpio_mix_bypass); gpio_output(rf_path->gpio_rx); - - /* - * Safe (initial) switch settings turn off both amplifiers and antenna port - * power and enable both amp bypass and mixer bypass. - */ - switchctrl_set(rf_path, SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_MIX_BYPASS); #elif RAD1O /* Configure RF switch control signals */ // clang-format off @@ -306,6 +304,12 @@ void rf_path_pin_setup(rf_path_t* const rf_path) /* Configure RF power supply (VAA) switch */ scu_pinmux(SCU_VAA_ENABLE, SCU_GPIO_FAST | SCU_CONF_FUNCTION0); + /* + * Safe (initial) switch settings turn off both amplifiers and antenna port + * power and enable both amp bypass and mixer bypass. + */ + switchctrl_set(rf_path, SWITCHCTRL_SAFE); + /* Configure RF switch control signals as outputs */ gpio_output(rf_path->gpio_tx_rx_n); gpio_output(rf_path->gpio_tx_rx); @@ -318,12 +322,6 @@ void rf_path_pin_setup(rf_path_t* const rf_path) gpio_output(rf_path->gpio_low_high_filt_n); gpio_output(rf_path->gpio_tx_amp); gpio_output(rf_path->gpio_rx_lna); - - /* - * Safe (initial) switch settings turn off both amplifiers and antenna port - * power and enable both amp bypass and mixer bypass. - */ - switchctrl_set(rf_path, SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_MIX_BYPASS); #else (void) rf_path; /* silence unused param warning */ #endif @@ -343,7 +341,7 @@ void rf_path_init(rf_path_t* const rf_path) #ifndef HACKRF_ONE mixer_setup(&mixer); #endif - switchctrl_set(rf_path, switchctrl); + rf_path->switchctrl = SWITCHCTRL_SAFE; } void rf_path_set_direction(rf_path_t* const rf_path, const rf_path_direction_t direction)