Im trying to capture DDR data from ADS5463 (TI ADC). As the datasheet suggested I need to delay the clock and sample the data with DRY clock. Im using Lattice FPGA LFE3-35EA.. and using Lattice High Speed I/O Interface with IPexpress:
using Diamond I creted this suggested Interface:
Afterwards I used this IP as is.. made my top module and just connected the pins, I made very few changes on the leds and inputs/outputs.
I connected the ADC to the FPGA using this pins:
USE PRIMARY NET "clk" ;
LOCATE COMP "clk" SITE "L4" ;
//FREQUENCY NET "clk" 200.000000 MHz ;
LOCATE COMP "rstn" SITE "C21" ;
LOCATE COMP "datain[0]" SITE "Y3" ;
LOCATE COMP "datain[1]" SITE "W2" ;
LOCATE COMP "datain[2]" SITE "T4" ;
LOCATE COMP "datain[3]" SITE "U1" ;
LOCATE COMP "datain[4]" SITE "P1" ;
LOCATE COMP "datain[5]" SITE "N2" ;
LOCATE COMP "datain[6]" SITE "L3" ;
LOCATE COMP "datain[7]" SITE "J2" ;
LOCATE COMP "datain[8]" SITE "G1" ;
LOCATE COMP "datain[9]" SITE "E1" ;
LOCATE COMP "datain[10]" SITE "D2" ;
LOCATE COMP "datain[11]" SITE "B1" ;
LOCATE COMP "led_clk" SITE "F19" ;
I supplied a sampling frequency of 400M (so the DRY clock is 200M as I config) and some data sine wave in diffrent frequencies:
1M:
On one hand i capture the right frequency, but i get very noisy results while I know it shouldnt happen. I should get clean Sine wave with clean FFT.
Im adding the matlab code also:
%% Read data from files
data1 = get_data('C:\Users\---\--.txt', '%*10s%13s%[^\n\r]', 11, inf);
data2 = get_data('C:\---\--.txt', '%*23s%14s%[^\n\r]', 11, inf);
source1 = zeros;
for k1 = 1:length(data1)
val = convertStringsToChars(data1(k1));
val = fliplr(val);
val = bin2dec(val);
source1(k1) = val;
end
source2 = zeros;
for k2 = 1:length(data2)
val = convertStringsToChars(data2(k2));
val = fliplr(val);
val = bin2dec(val);
source2(k2) = val;
end
source = zeros;
index=1;
for k2 = 1:length(source1)
source(index) = source1(k2);
index = index+1;
source(index) = source2(k2);
index = index+1;
end
% Plot the data
figure ('Name','test', 'units','normalized','outerposition',[0 0 1 1])
range = 1:1:length(source);
subplot(2,1,1);
plot(range,source);
axis([0 max(range) 0 4096])
title('Data - Time scale')
xlabel('Samples [n]')
ylabel('Amplitude')
grid
% FFT
Fs = 400e6; % Sampling frequency
T = 1/Fs; % Sampling period
L = max(range); % Length of signal
t = (0:L-1)*T; % Time vector
Y = fft(source);
Y(1)=0;
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
subplot(2,1,2);
plot(f,P1)
axis([0 100e6 0 100])
title('Data - Spectrum')
xlabel('f (Hz)')
ylabel('|P1(f)|')
Why is that happening, does someone have an idea? Im using the Interface as Lattice suggested and Im getting bad results. Anyone who is working with Lattice FPGA i will be glad for some help.
Edit:
I adding the 1MHz data coming out from the FPGA:
ps posedge_data negedge_data
delta rstn
0 +0 101111000001 101111000001 1
1 +0 101111000001 101111000001 1
2 +0 101111000001 101111000001 1
3 +0 101111000001 001111000001 1
4 +0 001111000001 101111000001 1
5 +0 101111000001 101111000001 1
6 +0 101111000001 101111000001 1
7 +0 001111000001 011111000001 1
8 +0 010111000001 010111000001 1
9 +0 010111000001 010111000001 1
10 +0 010111000001 010111000001 1
11 +0 110111000001 110111000001 1
12 +0 110111000001 110111000001 1
13 +0 110111000001 000111000001 1
14 +0 000111000001 010011000001 1
15 +0 000111000001 011011000001 1
16 +0 011011000001 111011000001 1
17 +0 101011000001 011011000001 1
18 +0 011011000001 011011000001 1
19 +0 010011000001 010011000001 1
20 +0 010011000001 000011000001 1
21 +0 000011000001 100101000001 1
22 +0 000011000001 101101000001 1
23 +0 101101000001 001101000001 1
24 +0 001101000001 001101000001 1
25 +0 001101000001 001101000001 1
26 +0 100101000001 100101000001 1
27 +0 000101000001 000001000001 1
28 +0 001001000001 001001000001 1
29 +0 001001000001 101001000001 1
30 +0 101001000001 101001000001 1
31 +0 101001000001 111110000001 1
32 +0 101001000001 111110000001 1
33 +0 111110000001 101110000001 1
34 +0 001110000001 011110000001 1
35 +0 010110000001 010110000001 1
36 +0 000110000001 010010000001 1
37 +0 011010000001 011010000001 1
38 +0 001010000001 011010000001 1
39 +0 001010000001 010010000001 1
40 +0 010010000001 110100000001 1
41 +0 111100000001 111100000001 1
42 +0 101100000001 011100000001 1
43 +0 010100000001 010100000001 1
44 +0 000100000001 010000000001 1
45 +0 000100000001 011000000001 1
46 +0 011000000001 010000000001 1
47 +0 010000000001 110111111110 1
48 +0 000000111111 111111111110 1
49 +0 111111111110 011111111110 1
50 +0 011111111110 011111111110 1
51 +0 110111111110 100111111110 1
52 +0 100111111110 010011111110 1
53 +0 011011111110 011011111110 1
54 +0 011011111110 010011111110 1
55 +0 010011111110 110101111110 1
56 +0 100011111110 111101111110 1
57 +0 011101111110 011101111110 1
58 +0 011101111110 110101111110 1
59 +0 110101111110 110101111110 1
60 +0 100101111110 111001111110 1
61 +0 111001111110 111001111110 1
62 +0 111001111110 111001111110 1
63 +0 110001111110 100001111110 1
64 +0 000001111110 010110111110 1
65 +0 011110111110 011110111110 1
66 +0 101110111110 111110111110 1
67 +0 001110111110 010110111110 1
68 +0 010110111110 010010111110 1
69 +0 000110111110 011010111110 1
70 +0 011010111110 011010111110 1
71 +0 001010111110 011010111110 1
72 +0 110010111110 110010111110 1
73 +0 010010111110 010100111110 1
74 +0 011100111110 011100111110 1
75 +0 011100111110 001100111110 1
76 +0 001100111110 011100111110 1
77 +0 001100111110 010100111110 1
78 +0 010100111110 010100111110 1
79 +0 010100111110 110100111110 1
80 +0 111000111110 111000111110 1
81 +0 101000111110 101000111110 1
82 +0 101000111110 001000111110 1
83 +0 001000111110 011000111110 1
84 +0 010000111110 110000111110 1
85 +0 110000111110 110000111110 1
86 +0 110000111110 110000111110 1
87 +0 100000111110 000000111110 1
88 +0 000000111110 110111011110 1
89 +0 111111011110 111111011110 1
90 +0 111111011110 111111011110 1
91 +0 111111011110 111111011110 1
92 +0 111111011110 111111011110 1
93 +0 101111011110 001111011110 1
94 +0 001111011110 001111011110 1
95 +0 001111011110 001111011110 1
96 +0 001111011110 001111011110 1
97 +0 001111011110 001111011110 1
98 +0 001111011110 001111011110 1
99 +0 001111011110 011111011110 1
Im adding also the 2MHz data points:
ps posedge_data negedge_data
delta rstn
0 +0 001100111110 001100111110 1
1 +0 000100111110 100000111110 1
2 +0 100100111110 101000111110 1
3 +0 101000111110 111000111110 1
4 +0 110000111110 100000111110 1
5 +0 100000111110 110111011110 1
6 +0 111111011110 011111011110 1
7 +0 011111011110 001111011110 1
8 +0 001111011110 011111011110 1
9 +0 010111011110 000111011110 1
10 +0 000111011110 000111011110 1
11 +0 000111011110 110011011110 1
12 +0 000111011110 111111011110 1
13 +0 111011011110 100111011110 1
14 +0 100111011110 100111011110 1
15 +0 100111011110 100111011110 1
16 +0 100111011110 100111011110 1
17 +0 100111011110 110111011110 1
18 +0 100111011110 110111011110 1
19 +0 110111011110 101000111110 1
20 +0 011111111110 000000111110 1
21 +0 000000111110 010000111110 1
22 +0 000000111110 100000111110 1
23 +0 110000111110 101000111110 1
24 +0 101000111110 111100111110 1
25 +0 100100111110 110100111110 1
26 +0 110100111110 101010111110 1
27 +0 011100111110 110010111110 1
28 +0 100010111110 110010111110 1
29 +0 111010111110 111110111110 1
30 +0 110110111110 110110111110 1
31 +0 110110111110 110001111110 1
32 +0 110001111110 010001111110 1
33 +0 011001111110 011101111110 1
34 +0 110101111110 110101111110 1
35 +0 111101111110 011011111110 1
36 +0 010011111110 110011111110 1
37 +0 111011111110 111111111110 1
38 +0 110111111110 110111111110 1
39 +0 111111100001 111000000001 1
40 +0 111000000001 011100000001 1
41 +0 011000000001 010100000001 1
42 +0 010100000001 011010000001 1
43 +0 011100000001 110010000001 1
44 +0 110010000001 111110000001 1
45 +0 111010000001 110110000001 1
46 +0 110110000001 111001000001 1
47 +0 011110000001 110001000001 1
48 +0 110001000001 111001000001 1
49 +0 111001000001 111101000001 1
50 +0 110101000001 110101000001 1
51 +0 011101000001 001011000001 1
52 +0 111101000001 100011000001 1
53 +0 100011000001 101011000001 1
54 +0 101011000001 101111000001 1
55 +0 101011000001 110111000001 1
56 +0 100111000001 100111000001 1
57 +0 110111000001 111111000001 1
58 +0 101111000001 111111000001 1
59 +0 111111000001 111111000001 1
60 +0 111111000001 111111000001 1
61 +0 111111100001 101000100001 1
62 +0 100000100001 100000100001 1
63 +0 100000100001 100000100001 1
64 +0 000000100001 100000100001 1
65 +0 100000100001 100000100001 1
66 +0 100000000001 110111000001 1
67 +0 111111000001 111111000001 1
68 +0 011111000001 001111000001 1
69 +0 001111000001 011111000001 1
70 +0 001111000001 000111000001 1
71 +0 010111000001 000011000001 1
72 +0 000111000001 001011000001 1
73 +0 001011000001 001011000001 1
74 +0 100011000001 110101000001 1
75 +0 111101000001 111101000001 1
76 +0 111101000001 110101000001 1
77 +0 110101000001 100001000001 1
78 +0 111001000001 101001000001 1
79 +0 001001000001 100110000001 1
80 +0 100001000001 101110000001 1
81 +0 001110000001 000010000001 1
82 +0 000110000001 010010000001 1
83 +0 010010000001 010100000001 1
84 +0 011100000001 011100000001 1
85 +0 001100000001 011000000001 1
86 +0 011000000001 010111111110 1
87 +0 010000111111 001111111110 1
88 +0 011111111110 101011111110 1
89 +0 101111111110 101011111110 1
90 +0 101011111110 101101111110 1
91 +0 101011111110 101101111110 1
92 +0 001101111110 101001111110 1
93 +0 101101111110 111001111110 1
94 +0 101001111110 111110111110 1
95 +0 111110111110 111110111110 1
96 +0 011110111110 110010111110 1
97 +0 110110111110 111010111110 1
98 +0 111010111110 110010111110 1
99 +0 010010111110 010100111110 1
I added 100 points out of 8192 captured points. In addition I will add picture of the signal generators which I used:
all the signals here I tried to analyze is -20dBm in diffrent frequencies.