-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetupPhaser.m
57 lines (49 loc) · 1.78 KB
/
setupPhaser.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
function bf = setupPhaser(rx,fc)
% Setup phaser for receive mode by default
%
% Copyright 2023 The MathWorks, Inc.
phaserURI = getPhaserURI();
% Configure phaser
bf = adi.Phaser;
bf.uri = phaserURI;
bf.SkipInit = true; % Bypass writing all initial attributes to speed things up
bf();
bf.ElementSpacing = physconst('LightSpeed') /fc/2; % half lambda spacing
% Put device in Rx mode
bf.TxRxSwitchControl = {'spi','spi'};
bf.Mode(:) = {'Disabled'};
bf.BeamMemEnable(:) = false;
bf.BiasMemEnable(:) = false;
bf.PolState(:) = false;
bf.PolSwitchEnable(:) = false;
bf.TRSwitchEnable(:) = true;
bf.ExternalTRPolarity(:) = true;
bf.RxVGAEnable(:) = true;
bf.RxVMEnable(:) = true;
bf.RxLNABiasCurrent(:) = 8;
bf.RxVGABiasCurrentVM(:) = 22;
% Self bias LNAs
bf.LNABiasOutEnable(:) = false;
% Fire them up
bf.RxPowerDown(:) = false;
bf.Mode(:) = {'Rx'};
% Set up PLL
bf.Frequency = (fc + rx.CenterFrequency) / 4;
BW = 500e6 / 4; num_steps = 500;
bf.FrequencyDeviationRange = BW; % frequency deviation range in H1. This is the total freq deviation of the complete freq ramp
bf.FrequencyDeviationStep = int64(BW / num_steps); % frequency deviation step in Hz. This is fDEV, in Hz. Can be positive or negative
bf.RampMode = "disabled";
bf.DelayStartWord = 4095;
bf.DelayClockSource = "PFD";
bf.FrequencyDeviationTime = 1000; % total time (in us) of the complete frequency ramp
bf.DelayStartEnable = false; % delay start
bf.RampDelayEnable = false; % delay between ramps.
bf.TriggerDelayEnable = false; % triangle delay
bf.SingleFullTriangleEnable = false; % full triangle enable/disable -- this is used with the single_ramp_burst mode
bf.TriggerEnable = false; % start a ramp with TXdata
% Flatten phaser phase/gain
bf.RxGain(:) = 127;
bf.RxAttn(:) = 0;
bf.RxPhase(:) = 0;
bf.RxLNAEnable(:) = true;
bf.LatchRxSettings();