Skip to content

Commit 9c30466

Browse files
author
George Mencoff
committed
add calibration script to be run before running labs
1 parent fa1460c commit 9c30466

10 files changed

+27
-9
lines changed

Diff for: demos/radar/helpers/arrangePulseData.m

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
%
44
% Copyright 2023 The MathWorks, Inc.
55

6+
% Combine data from channels with calibration weights
7+
calweights = loadCalibrationWeights().DigitalWeights;
8+
indata = indata * conj(calweights);
9+
610
% Extract timing from pluto and phaser setup
711
fs = rx.SamplingRate;
812
tsweep = double(bf.FrequencyDeviationTime) / 1e6;

Diff for: shared/calibration/CalibrationValueFormat.m

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
% Copyright 2023 The MathWorks, Inc.
66

77
properties
8-
AnalogWeights
9-
DigitalWeights
8+
AnalogWeights = ones(4,2);
9+
DigitalWeights = ones(2,1);
1010
end
1111

1212
methods
@@ -15,5 +15,4 @@
1515
s.DigitalWeights = this.DigitalWeights;
1616
end
1717
end
18-
end
19-
18+
end

Diff for: shared/calibration/generateCalibrationWeights.m

+4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ function generateCalibrationWeights()
1818
% Find the hb100 center frequency
1919
fc_hb100 = findTxFrequency();
2020

21+
pause(5);
22+
2123
% Save the gain profile for the antenna.
2224
saveGainProfile(fc_hb100);
2325

26+
pause(5);
27+
2428
% Get the calibration data
2529
CalibrationData = calibrationRoutine(fc_hb100);
2630

Diff for: shared/calibration/loadCalibrationWeights.m

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
filepath = fileparts(which('generateCalibrationWeights'));
55
calweights_filename = [filepath,'\','CalibrationWeights.mat'];
6-
load(calweights_filename,'calibrationweights');
6+
if isfile(calweights_filename)
7+
load(calweights_filename,'calibrationweights');
8+
else
9+
calibrationweights = CalibrationValueFormat;
10+
end
11+
712

813
end

Diff for: shared/phasercontrol/helperGainCodes.m

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function calibGainCode = helperGainCodes(analogWeights)
22
% Get gain code for each subarray
33

4-
% Copyright 2023 The MathWorks, Inc.
4+
% Copyright 2023-2025 The MathWorks, Inc.
55

66
sub1weights = analogWeights(:,1);
77
sub2weights = analogWeights(:,2);
@@ -10,7 +10,11 @@
1010

1111
% Loading the measured gain profiles. These are captured using the
1212
% script saveGainProfile.m.
13-
load('GainProfile.mat','subArray1_NormalizedGainProfile','subArray2_NormalizedGainProfile','gaincode');
13+
try
14+
load('GainProfile.mat','subArray1_NormalizedGainProfile','subArray2_NormalizedGainProfile','gaincode');
15+
catch
16+
error('No GainProfile.mat file was found. Please run calibration');
17+
end
1418

1519
calibGainCode = zeros(1,8);
1620
for nch = 1 : 4

Diff for: workshop/Calibrate Antenna.mlx

132 KB
Binary file not shown.

Diff for: workshop/Lab 1 - FMCW.mlx

9 Bytes
Binary file not shown.

Diff for: workshop/Lab 2 - RangeDoppler.mlx

30.6 KB
Binary file not shown.

Diff for: workshop/Lab 3 - Radar Signal Processing.mlx

-441 Bytes
Binary file not shown.

Diff for: workshop/setupLabRadar.m

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@
2929
tx.DataSource = "DMA";
3030

3131
% Setup beamformers all to max gain with no phase shifts
32-
% TODO: this is where we should include calibration coefficients
32+
calibrationweights = loadCalibrationWeights();
3333
bf = setupPhaser(rx,fc);
3434
bf.RxPowerDown(:) = 0;
35-
bf.RxGain(:) = 127;
35+
36+
% Load calibration data into beamformer
37+
setAnalogBfWeights(bf,calibrationweights.AnalogWeights);
3638

3739
% Setup Phase Locked Loop (PLL)
3840
bf.Frequency = (fc+rx.CenterFrequency)/4;

0 commit comments

Comments
 (0)