diff --git a/firmware/common/platform_scu.c b/firmware/common/platform_scu.c index f29ac543..df611bd2 100644 --- a/firmware/common/platform_scu.c +++ b/firmware/common/platform_scu.c @@ -176,7 +176,7 @@ const platform_scu_t* platform_scu(void) scu.XCVR_RXHP_PINCFG = (SCU_GPIO_FAST | SCU_CONF_FUNCTION4); scu.XCVR_LD_PINCFG = (SCU_GPIO_FAST | SCU_CONF_FUNCTION0 | SCU_CONF_EPD_EN_PULLDOWN | SCU_CONF_EPUN_DIS_PULLUP); -#elif defined(JELLYBEAN) || defined(JAWBREAKER) || defined(HACKRF_ONE) +#elif defined(JAWBREAKER) || defined(HACKRF_ONE) scu.XCVR_ENABLE = P4_6; /* GPIO2[6] on P4_6 */ scu.XCVR_RXENABLE = P4_5; /* GPIO2[5] on P4_5 */ scu.XCVR_TXENABLE = P4_4; /* GPIO2[4] on P4_4 */ diff --git a/firmware/common/rf_path.c b/firmware/common/rf_path.c index c78ec831..30c8c718 100644 --- a/firmware/common/rf_path.c +++ b/firmware/common/rf_path.c @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 Great Scott Gadgets + * Copyright 2012-2026 Great Scott Gadgets * Copyright 2012 Jared Boone * Copyright 2013 Benjamin Vernoux * @@ -38,57 +38,55 @@ #include "platform_scu.h" #endif -#if defined(JAWBREAKER) || defined(HACKRF_ONE) || defined(RAD1O) || defined(PRALINE) - /* - * RF switches on Jawbreaker are controlled by General Purpose Outputs (GPO) on - * the RFFC5072. - * - * On HackRF One, the same signals are controlled by GPIO on the LPC. - * SWITCHCTRL_NO_TX_AMP_PWR and SWITCHCTRL_NO_RX_AMP_PWR are not normally used - * on HackRF One as the amplifier power is instead controlled only by - * SWITCHCTRL_AMP_BYPASS. - * - * The rad1o also uses GPIO pins to control the different switches. The amplifiers - * are also connected to the LPC. - * - * On Praline, a subset of control signals is managed by GPIO pins on the LPC, while - * the remaining signals are generated through combinatorial logic in hardware. - */ - #define SWITCHCTRL_NO_TX_AMP_PWR (1 << 0) /* GPO1 turn off TX amp power */ - #define SWITCHCTRL_AMP_BYPASS (1 << 1) /* GPO2 bypass amp section */ - #define SWITCHCTRL_TX (1 << 2) /* GPO3 1 for TX mode, 0 for RX mode */ - #define SWITCHCTRL_MIX_BYPASS (1 << 3) /* GPO4 bypass RFFC5072 mixer section */ - #define SWITCHCTRL_HP (1 << 4) /* GPO5 1 for high-pass, 0 for low-pass */ - #define SWITCHCTRL_NO_RX_AMP_PWR (1 << 5) /* GPO6 turn off RX amp power */ - - /* - GPO6 GPO5 GPO4 GPO3 GPO2 GPO1 - !RXAMP HP MIXBP TX AMPBP !TXAMP Mix mode Amp mode - 1 X 1 1 1 1 TX bypass Bypass - 1 X 1 1 0 0 TX bypass TX amplified - 1 1 0 1 1 1 TX high Bypass - 1 1 0 1 0 0 TX high TX amplified - 1 0 0 1 1 1 TX low Bypass - 1 0 0 1 0 0 TX low TX amplified - 1 X 1 0 1 1 RX bypass Bypass - 0 X 1 0 0 1 RX bypass RX amplified - 1 1 0 0 1 1 RX high Bypass - 0 1 0 0 0 1 RX high RX amplified - 1 0 0 0 1 1 RX low Bypass - 0 0 0 0 0 1 RX low RX amplified - */ - - /* - * Safe (initial) switch settings turn off both amplifiers and enable both amp - * bypass and mixer bypass. - */ - #define SWITCHCTRL_SAFE \ - (SWITCHCTRL_NO_TX_AMP_PWR | SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_TX | \ - SWITCHCTRL_MIX_BYPASS | SWITCHCTRL_HP | SWITCHCTRL_NO_RX_AMP_PWR) -#endif +/* + * RF switches on Jawbreaker are controlled by General Purpose Outputs (GPO) on + * the RFFC5072. + * + * On HackRF One, the same signals are controlled by GPIO on the LPC. + * SWITCHCTRL_NO_TX_AMP_PWR and SWITCHCTRL_NO_RX_AMP_PWR are not normally used + * on HackRF One as the amplifier power is instead controlled only by + * SWITCHCTRL_AMP_BYPASS. + * + * The rad1o also uses GPIO pins to control the different switches. The amplifiers + * are also connected to the LPC. + * + * On Praline, a subset of control signals is managed by GPIO pins on the LPC, while + * the remaining signals are generated through combinatorial logic in hardware. + */ +#define SWITCHCTRL_NO_TX_AMP_PWR (1 << 0) /* GPO1 turn off TX amp power */ +#define SWITCHCTRL_AMP_BYPASS (1 << 1) /* GPO2 bypass amp section */ +#define SWITCHCTRL_TX (1 << 2) /* GPO3 1 for TX mode, 0 for RX mode */ +#define SWITCHCTRL_MIX_BYPASS (1 << 3) /* GPO4 bypass RFFC5072 mixer section */ +#define SWITCHCTRL_HP (1 << 4) /* GPO5 1 for high-pass, 0 for low-pass */ +#define SWITCHCTRL_NO_RX_AMP_PWR (1 << 5) /* GPO6 turn off RX amp power */ /* - * Antenna port power on HackRF One (prior to r9) is controlled by GPO1 on the + * GPO6 GPO5 GPO4 GPO3 GPO2 GPO1 + * !RXAMP HP MIXBP TX AMPBP !TXAMP Mix mode Amp mode + * 1 X 1 1 1 1 TX bypass Bypass + * 1 X 1 1 0 0 TX bypass TX amplified + * 1 1 0 1 1 1 TX high Bypass + * 1 1 0 1 0 0 TX high TX amplified + * 1 0 0 1 1 1 TX low Bypass + * 1 0 0 1 0 0 TX low TX amplified + * 1 X 1 0 1 1 RX bypass Bypass + * 0 X 1 0 0 1 RX bypass RX amplified + * 1 1 0 0 1 1 RX high Bypass + * 0 1 0 0 0 1 RX high RX amplified + * 1 0 0 0 1 1 RX low Bypass + * 0 0 0 0 0 1 RX low RX amplified + */ + +/* + * Safe (initial) switch settings turn off both amplifiers and enable both amp + * bypass and mixer bypass. + */ +#define SWITCHCTRL_SAFE \ + (SWITCHCTRL_NO_TX_AMP_PWR | SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_TX | \ + SWITCHCTRL_MIX_BYPASS | SWITCHCTRL_HP | SWITCHCTRL_NO_RX_AMP_PWR) + +/* + * Antenna port power on HackRF One (except r9) is controlled by GPO1 on the * RFFC5072. This is the only thing we use RFFC5072 GPO for on HackRF One. * The value of SWITCHCTRL_NO_ANT_PWR does not correspond to the GPO1 bit in * the gpo register. @@ -313,7 +311,7 @@ static void switchctrl_set(rf_path_t* const rf_path, const uint8_t gpo) void rf_path_pin_setup(rf_path_t* const rf_path) { -#if !defined(JELLYBEAN) && !defined(JAWBREAKER) +#if !defined(JAWBREAKER) const platform_scu_t* scu = platform_scu(); #endif