|
| 1 | +ADF4350 no-OS Driver |
| 2 | +==================== |
| 3 | + |
| 4 | +Supported Devices |
| 5 | +------------------ |
| 6 | + |
| 7 | +- :adi:`ADF4350` |
| 8 | + |
| 9 | +Overview |
| 10 | +-------- |
| 11 | + |
| 12 | +The ADF4350 is a wideband synthesizer with an integrated |
| 13 | +voltage-controlled oscillator (VCO), capable of generating frequencies |
| 14 | +from 137.5 MHz to 4400 MHz. It supports both fractional-N and integer-N |
| 15 | +synthesizer capabilities and includes a programmable output divider |
| 16 | +(1 to 16) to offer flexibility in frequency generation. The device delivers |
| 17 | +low phase noise with typical RMS jitter of less than 0.4 ps, making it |
| 18 | +suitable for RF applications. The ADF4350 features RF output muting, |
| 19 | +a 3-wire serial interface, and can be configured with external loop |
| 20 | +filters and reference frequencies, facilitating integration into various |
| 21 | +RF communication systems including wireless infrastructure and test |
| 22 | +equipment. |
| 23 | + |
| 24 | +Applications |
| 25 | +------------- |
| 26 | + |
| 27 | +- Wireless infrastructure (W-CDMA, TD-SCDMA, WiMAX, GSM, PCS, DCS, DECT) |
| 28 | +- Test equipment |
| 29 | +- Wireless LANs, CATV equipment |
| 30 | +- Clock generation |
| 31 | + |
| 32 | +Device Configuration |
| 33 | +--------------------- |
| 34 | + |
| 35 | +Initialization |
| 36 | +~~~~~~~~~~~~~~ |
| 37 | + |
| 38 | +The ``adf4350_setup`` function initializes the ADF4350 frequency |
| 39 | +synthesizer by allocating memory for the device structure and |
| 40 | +configuring the SPI interface. Essential parameters such as input clock |
| 41 | +frequency, channel spacing, and power-up frequency are set based on user |
| 42 | +configuration, preparing the device for operation. |
| 43 | + |
| 44 | +Frequency Configuration |
| 45 | +~~~~~~~~~~~~~~~~~~~~~~~ |
| 46 | + |
| 47 | +These functions manage frequency configuration. ``adf4350_set_freq`` sets |
| 48 | +the output frequency by calculating and applying necessary register |
| 49 | +values. ``adf4350_out_altvoltage0_frequency`` leverages ``adf4350_set_freq`` |
| 50 | +to implement frequency adjustments, simplifying the frequency setting |
| 51 | +application. |
| 52 | + |
| 53 | +``adf4350_out_altvoltage0_frequency_resolution`` manages the channel |
| 54 | +spacing or frequency resolution by updating internal configurations. |
| 55 | +It ensures that frequency steps align with application requirements, |
| 56 | +providing fine-grained frequency control. |
| 57 | + |
| 58 | +Reference Input |
| 59 | +~~~~~~~~~~~~~~~ |
| 60 | + |
| 61 | +``adf4350_out_altvoltage0_refin_frequency`` function allows setting and |
| 62 | +retrieving the reference input frequency. It ensures the internal clock |
| 63 | +complies with specified operational parameters, aiding in maintaining |
| 64 | +stable frequency synthesis. |
| 65 | + |
| 66 | +Power Management |
| 67 | +~~~~~~~~~~~~~~~~ |
| 68 | + |
| 69 | +``adf4350_out_altvoltage0_powerdown`` handles transitions between active |
| 70 | +and low-power states by setting appropriate register bits, supporting |
| 71 | +applications prioritizing power efficiency. |
| 72 | + |
| 73 | +Data Communication Functions |
| 74 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 75 | + |
| 76 | +The ``adf4350_write`` function transmits data to the ADF4350 registers, |
| 77 | +segmenting 32-bit data into 8-bit chunks for SPI compatibility. |
| 78 | +``adf4350_sync_config`` synchronizes software with hardware register |
| 79 | +values, ensuring configuration consistency through conditional |
| 80 | +buffering. |
| 81 | + |
| 82 | +Miscellaneous Functions |
| 83 | +~~~~~~~~~~~~~~~~~~~~~~~ |
| 84 | + |
| 85 | +``adf4350_tune_r_cnt`` adjusts the R counter for maintaining the PFD |
| 86 | +frequency under a defined limit. It incrementally adjusts values to |
| 87 | +achieve suitable frequency division settings. The ``gcd`` function computes |
| 88 | +the greatest common divisor using the Euclidean algorithm. It supports |
| 89 | +optimizing modulus calculations in frequency settings, reinforcing |
| 90 | +configuration precision. |
| 91 | + |
| 92 | +Operation Modes |
| 93 | +---------------- |
| 94 | + |
| 95 | ++-----------------+-----------------+-------------------------------------+-----------------+ |
| 96 | +| **Mode Name** | **Description** | **Configuration Bits** | **Typical Use | |
| 97 | +| | | | Case** | |
| 98 | ++-----------------+-----------------+-------------------------------------+-----------------+ |
| 99 | +| Band Select | Activates high | band_select_clock_mode_high_enable | Scenarios | |
| 100 | +| Clock Mode | band select | | requiring fine | |
| 101 | +| | clock mode for | | frequency | |
| 102 | +| | specific | | selection. | |
| 103 | +| | frequency | | | |
| 104 | +| | selection. | | | |
| 105 | ++-----------------+-----------------+-------------------------------------+-----------------+ |
| 106 | +| Feedback Mode | Adjusts | ADF4350_REG4_FEEDBACK_DIVIDED | Systems needing | |
| 107 | +| | feedback path | | stabilized | |
| 108 | +| | to divided | | frequency | |
| 109 | +| | mode, altering | | output. | |
| 110 | +| | the feedback | | | |
| 111 | +| | loop | | | |
| 112 | +| | configuration. | | | |
| 113 | ++-----------------+-----------------+-------------------------------------+-----------------+ |
| 114 | +| LDF Mode | Configures load | ADF4350_REG2_LDF_FRACT_N | Applications | |
| 115 | +| | detection for | | needing precise | |
| 116 | +| | fractional-N | | frequency | |
| 117 | +| | mode, | | synthesis. | |
| 118 | +| | optimizing PLL | | | |
| 119 | +| | operation. | | | |
| 120 | ++-----------------+-----------------+-------------------------------------+-----------------+ |
| 121 | +| Noise Mode | Sets noise mode | ADF4350_REG2_NOISE_MODE | Environments | |
| 122 | +| | via register | | sensitive to | |
| 123 | +| | configuration, | | noise | |
| 124 | +| | affecting | | performance. | |
| 125 | +| | synthesizer | | | |
| 126 | +| | noise. | | | |
| 127 | ++-----------------+-----------------+-------------------------------------+-----------------+ |
| 128 | +| MUXOUT Mode | Controls output | ADF4350_REG2_MUXOUT | Situations | |
| 129 | +| | mode of the | | requiring | |
| 130 | +| | MUXOUT pin by | | specific pin | |
| 131 | +| | setting the | | output modes, | |
| 132 | +| | configuration. | | like test | |
| 133 | +| | | | setups. | |
| 134 | ++-----------------+-----------------+-------------------------------------+-----------------+ |
| 135 | +| Lock Detect | Sets lock | ADF4350_REG5_LD_PIN_MODE_DIGITAL | Applications | |
| 136 | +| Mode | detect pin to | | monitoring | |
| 137 | +| | digital mode to | | frequency lock | |
| 138 | +| | manage lock | | stability. | |
| 139 | +| | indication. | | | |
| 140 | ++-----------------+-----------------+-------------------------------------+-----------------+ |
| 141 | + |
| 142 | +Driver Initialization Example |
| 143 | +----------------------------- |
| 144 | + |
| 145 | +.. code-block:: C |
| 146 | +
|
| 147 | + #include <stdio.h> |
| 148 | + #include "xil_cache.h" |
| 149 | + #include "xparameters.h" |
| 150 | + #include "no_os_spi.h" |
| 151 | + #include "adf4350.h" |
| 152 | + #include "parameters.h" |
| 153 | + #include "xilinx_spi.h" |
| 154 | + #include "no_os_print_log.h" |
| 155 | +
|
| 156 | + /* SPI Initialization Structures */ |
| 157 | + struct xil_spi_init_param xil_spi_param = { |
| 158 | + .type = SPI_PS, |
| 159 | + }; |
| 160 | +
|
| 161 | + struct no_os_spi_init_param adf4350_spi_param = { |
| 162 | + .device_id = XPAR_PS7_SPI_0_DEVICE_ID, |
| 163 | + .max_speed_hz = 5000000u, |
| 164 | + .chip_select = 0, |
| 165 | + .mode = NO_OS_SPI_MODE_0, |
| 166 | + .extra = &xil_spi_param, |
| 167 | + .platform_ops = &xil_spi_ops, |
| 168 | + }; |
| 169 | +
|
| 170 | + adf4350_init_param default_adf4350_init_param = { |
| 171 | + .spi_init = adf4350_spi_param, |
| 172 | + .clkin = 25000000, |
| 173 | + .channel_spacing = 10000, |
| 174 | + .power_up_frequency = 2500000000ul, |
| 175 | + .reference_div_factor = 0, |
| 176 | + .reference_doubler_enable = 0, |
| 177 | + .reference_div2_enable = 0, |
| 178 | + .phase_detector_polarity_positive_enable = 1, |
| 179 | + .lock_detect_precision_6ns_enable = 0, |
| 180 | + .lock_detect_function_integer_n_enable = 0, |
| 181 | + .charge_pump_current = 2500, |
| 182 | + .muxout_select = 0, |
| 183 | + .low_spur_mode_enable = 0, |
| 184 | + .cycle_slip_reduction_enable = 0, |
| 185 | + .charge_cancellation_enable = 0, |
| 186 | + .anti_backlash_3ns_enable = 0, |
| 187 | + .band_select_clock_mode_high_enable = 0, |
| 188 | + .clk_divider_12bit = 0, |
| 189 | + .clk_divider_mode = 0, |
| 190 | + .aux_output_enable = 0, |
| 191 | + .aux_output_fundamental_enable = 1, |
| 192 | + .mute_till_lock_enable = 0, |
| 193 | + .output_power = 3, |
| 194 | + .aux_output_power = 0, |
| 195 | + }; |
| 196 | +
|
| 197 | + adf4350_dev *adf4350_device; |
| 198 | +
|
| 199 | + int main(void) |
| 200 | + { |
| 201 | + int32_t status; |
| 202 | +
|
| 203 | + Xil_ICacheEnable(); |
| 204 | + Xil_DCacheEnable(); |
| 205 | +
|
| 206 | + status = adf4350_setup(&adf4350_device, default_adf4350_init_param); |
| 207 | + if (status != 0) { |
| 208 | + pr_info("adf4350_setup() failed!"); |
| 209 | + return -1; |
| 210 | + } |
| 211 | +
|
| 212 | + pr_info("Done.\n"); |
| 213 | +
|
| 214 | + Xil_ICacheDisable(); |
| 215 | + Xil_DCacheDisable(); |
| 216 | +
|
| 217 | + return 0; |
| 218 | + } |
0 commit comments