mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-08-22 07:29:03 +00:00
8f5b25b10d
* fix clock init and add mayhem tx capacity * aligned external clock and RX config * fix(clock): cap TX interpolation to x16 to prevent doubled waveform speed The TX gateware only implements interpolation factors x1..x16 (tx_intrp 0..4), but the rate search could select n==5 (x32) for very low TX sample rates. That left the AFE/CLK0/CLK1 running at the x32 rate while the FPGA only interpolated by x16, clocking the TX datapath at twice the gateware output rate. Cap afe_rate and _resampling_n to the x16 limit in TX so the clocks stay aligned with the interpolation setting. * fix(praline): source PLL1 from 40MHz GP_CLKIN instead of 12MHz XTAL For the intermediate 90-110MHz PLL1 stepping stage, source PLL1 from GP_CLKIN (Si5351 CLK2/MCU_CLK at 40MHz) giving N=2, M=10, Fclk=100MHz, rather than the on-chip 12MHz XTAL bootstrap path. This matches the non-PRALINE path. Remove the dead commented-out XTAL enable/PLL code. * docs(fpga_bridge): correct register 0x03 description for PRALINE gateware Register 0x03 is RX_DIGITAL_GAIN in RX and TX_NCO_CTRL in TX, not RX_PSTEP. * Fix fpga_tx_set_nco_enable to use FPGA_REG3_TX_NCO_CTRL (0x03)
90 lines
2.4 KiB
C++
90 lines
2.4 KiB
C++
/*
|
|
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
|
*
|
|
* This file is part of PortaPack.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; see the file COPYING. If not, write to
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
* Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
#ifndef __RF_PATH_H__
|
|
#define __RF_PATH_H__
|
|
|
|
#include "utility.hpp"
|
|
|
|
#include <cstdint>
|
|
|
|
namespace rf {
|
|
|
|
using Frequency = int64_t;
|
|
using FrequencyRange = range_t<Frequency>;
|
|
|
|
enum class Direction {
|
|
/* Zero-based, used as index into table */
|
|
Receive = 0,
|
|
Transmit = 1,
|
|
};
|
|
|
|
namespace path {
|
|
|
|
#ifdef PRALINE
|
|
/* PRALINE: MAX2831 direct path is 2320-2740 MHz */
|
|
constexpr FrequencyRange band_low{0, 2320'000'000};
|
|
constexpr FrequencyRange band_high{2740'000'000, 7250'000'000};
|
|
constexpr FrequencyRange band_mid{band_low.maximum, band_high.minimum};
|
|
#else
|
|
/* HackRF One: Original band boundaries */
|
|
constexpr FrequencyRange band_low{0, 2170'000'000};
|
|
constexpr FrequencyRange band_high{2740'000'000, 7250'000'000};
|
|
constexpr FrequencyRange band_mid{band_low.maximum, band_high.minimum};
|
|
#endif
|
|
|
|
enum class Band {
|
|
/* Zero-based, used as index into frequency_bands table */
|
|
Low = 0,
|
|
Mid = 1,
|
|
High = 2,
|
|
};
|
|
|
|
class Path {
|
|
public:
|
|
void init();
|
|
|
|
void set_direction(const Direction direction);
|
|
void set_band(const Band band);
|
|
void set_rf_amp(const bool rf_amp);
|
|
void set_antenna_bias(const bool antenna_bias);
|
|
|
|
Band get_band() const { return _band; } //_band is used solely for debugging purposes.
|
|
|
|
private:
|
|
Direction direction{Direction::Receive};
|
|
Band band{Band::Mid};
|
|
bool rf_amp{false};
|
|
bool antenna_bias{false};
|
|
|
|
void update();
|
|
|
|
Band _band{Band::Mid}; //_band is solely used of debugging purposes
|
|
};
|
|
|
|
} // namespace path
|
|
|
|
constexpr FrequencyRange tuning_range{path::band_low.minimum, path::band_high.maximum};
|
|
|
|
} // namespace rf
|
|
|
|
#endif /*__RF_PATH_H__*/
|