我正在尝试在 FPGA 中实现 BPSK 解调器。首先,我在 MATLAB 中对系统进行建模。现在,我正在尝试设计用于载波同步的 Costas Loop。这是我要实现的框图:
我使用 RRC 作为低通滤波器。这是 MATLAB 代码:
load RRC.mat
fc = 0.05; % 0.11 %0.09
N = length(rf_signal);
bb = zeros(1, N);
bb_f = zeros(1, N);
I_f = zeros(1, N);
Q_f = zeros(1, N);
I_r = zeros(1, N);
Q_r = zeros(1, N);
error = zeros(1, N);
PhErr = zeros(1, N);
error_integral = zeros(1, N);
Theta = zeros(1, N);
% Loop Filter Coefficients
BW = 100; % Hz
loop_theta = 2*pi*BW;
C1 = 4*(loop_theta)^2/(1+sqrt(2)*loop_theta+loop_theta^2);
C2 = 2*sqrt(2)*loop_theta/(1+sqrt(2)*loop_theta+loop_theta^2);
for i = 2:N
% Downconverting to Baseband
bb(i) = rf_signal(i).*exp(j*2*pi*fc*i).*exp(j*Theta(i-1));
% Filtering
bb_f = filter(RRC, bb(1:i));
I_f(i) = real(bb_f(i));
Q_f(i) = imag(bb_f(i));
% Error
error(i) = I_f(i).*Q_f(i);
% Loop Filter
error_integral(i) = error(i).*C1 + error_integral(i-1);
PhErr(i) = error(i).*C2 + error_integral(i);
% Phase Accumulator
Theta(i) = Theta(i-1) + PhErr(i);
end
figure; subplot 221; plot(real(bb)); title('I Channel')
subplot 222; plot(imag(bb)); title('Q Channel')
subplot 223; plot(I_f); title('I Channel Filter')
subplot 224; plot(Q_f); title('Q Channel Filter')
figure; subplot 311; plot(error); title('Phase Error');
subplot 312; plot(PhErr); title('Loop Filter');
subplot 313; plot(Theta); title('Control Signal \theta');
rf_signal
来自另一个生成 BPSK 信号的脚本。但是,当我关闭环路并完全按照发射器设置频率时,我会得到这些波形:
虽然当我打开环路时信号解调得很好。我用余弦波测试了环路,它通过产生直流信号工作得很好。
任何意见,将不胜感激。