From 1ec9f560b48eb8e32a696b2480c859063ffa2e38 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Tue, 17 Sep 2013 17:25:00 -0700 Subject: [PATCH] Move more RF path stuff (initialization and MAX5864 state management) into rf_path.c. Changed initial RF path mode to lowest power (OFF). Remove initial MAX2837 IF setting -- it's a waste of effort when the first (and necessary) tuning operation will reset it anyway (perhaps to a different value). --- firmware/common/rf_path.c | 21 ++++++++++++++++++++- firmware/hackrf_usb/hackrf_usb.c | 10 ---------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/firmware/common/rf_path.c b/firmware/common/rf_path.c index c241067f..556f15e5 100644 --- a/firmware/common/rf_path.c +++ b/firmware/common/rf_path.c @@ -22,8 +22,11 @@ #include "rf_path.h" +#include + #include #include +#include #ifdef JAWBREAKER /* @@ -64,7 +67,14 @@ uint8_t switchctrl = SWITCHCTRL_SAFE; void rf_path_init(void) { - rffc5071_set_gpo(switchctrl); + ssp1_set_mode_max5864(); + max5864_shutdown(); + + ssp1_set_mode_max2837(); + max2837_setup(); + max2837_mode_shutdown(); + + rffc5071_setup(); } void rf_path_set_direction(const rf_path_direction_t direction) { @@ -83,6 +93,9 @@ void rf_path_set_direction(const rf_path_direction_t direction) { } else { rffc5071_enable(); } + ssp1_set_mode_max5864(); + max5864_tx(); + ssp1_set_mode_max2837(); max2837_start(); max2837_tx(); break; @@ -99,6 +112,9 @@ void rf_path_set_direction(const rf_path_direction_t direction) { } else { rffc5071_enable(); } + ssp1_set_mode_max5864(); + max5864_rx(); + ssp1_set_mode_max2837(); max2837_start(); max2837_rx(); break; @@ -108,6 +124,9 @@ void rf_path_set_direction(const rf_path_direction_t direction) { /* Set RF path to receive direction when "off" */ switchctrl &= ~SWITCHCTRL_TX; rffc5071_disable(); + ssp1_set_mode_max5864(); + max5864_shutdown(); + ssp1_set_mode_max2837(); max2837_stop(); break; } diff --git a/firmware/hackrf_usb/hackrf_usb.c b/firmware/hackrf_usb/hackrf_usb.c index 04ec8dc8..064f1467 100644 --- a/firmware/hackrf_usb/hackrf_usb.c +++ b/firmware/hackrf_usb/hackrf_usb.c @@ -777,8 +777,6 @@ void usb_configuration_changed( } int main(void) { - const uint32_t ifreq = 2600000000U; - pin_setup(); enable_1v8_power(); cpu_clock_init(); @@ -801,15 +799,7 @@ int main(void) { usb_run(&usb_device); ssp1_init(); - ssp1_set_mode_max5864(); - max5864_xcvr(); - ssp1_set_mode_max2837(); - max2837_setup(); - max2837_set_frequency(ifreq); - - rffc5071_setup(); - rf_path_init(); unsigned int phase = 0;