Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 45a9466

Browse files
authored
Merge pull request #56 from analogdevicesinc/merge-freq-hop
Frequency hopping example
2 parents 0aacd07 + 28c1b14 commit 45a9466

40 files changed

+2116
-28
lines changed

+adi/+common/DebugAttribute.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
classdef (Abstract) DebugAttribute < matlabshared.libiio.base
22

3-
methods (Hidden, Access = protected)
3+
methods (Hidden)
44
function setDebugAttributeLongLong(obj,attr,value)
55
phydev = getDev(obj, obj.phyDevName);
66
if (nargin == 1)
@@ -26,13 +26,13 @@ function setDebugAttributeBool(obj,attr,value)
2626
end
2727
status = iio_device_debug_attr_write_bool(obj,phydev,attr,value);
2828
cstatus(obj,status,['Attribute write failed for : ' attr]);
29-
% Check
30-
[status, rValue] = iio_device_debug_attr_read_bool(obj,phydev,attr);
31-
cstatus(obj,status,['Error reading attribute: ' attr]);
32-
if value ~= rValue
33-
status = -1;
34-
cstatus(obj,status,['Attribute ' attr ' return value ' num2str(rValue) ', expected ' num2str(value)]);
35-
end
29+
% Check (Not implemented yet)
30+
% [status, rValue] = iio_device_debug_attr_read_bool(obj,phydev,attr);
31+
% cstatus(obj,status,['Error reading attribute: ' attr]);
32+
% if value ~= rValue
33+
% status = -1;
34+
% cstatus(obj,status,['Attribute ' attr ' return value ' num2str(rValue) ', expected ' num2str(value)]);
35+
% end
3636
end
3737
end
3838
end

+adi/+common/Rx.m

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@
77

88
function varargout = stepImpl(obj)
99
% Get the data
10-
[dataRAW, valid] = getData(obj);
11-
index = 1;
1210
c = obj.channelCount/2;
13-
varargout = cell(c+1,1);
14-
for k = 1:c
15-
varargout{k} = complex(dataRAW(index,:),dataRAW(index+1,:)).';
16-
index = index+2;
11+
if c > 0
12+
[dataRAW, valid] = getData(obj);
13+
index = 1;
14+
varargout = cell(c+1,1);
15+
for k = 1:c
16+
varargout{k} = complex(dataRAW(index,:),dataRAW(index+1,:)).';
17+
index = index+2;
18+
end
19+
varargout{end} = valid;
20+
else
21+
varargout = cell(1,1);
22+
varargout{1} = true;
1723
end
18-
varargout{end} = valid;
1924
end
2025

2126
end

+adi/+common/RxTx.m

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,18 @@ function releaseChanBuffers(obj)
106106
obj.enabledChannels = true;
107107

108108
% Create the buffers
109-
status = createBuf(obj);
110-
if status
111-
for k=1:obj.channelCount
112-
disableChannel(obj, obj.channel_names{k}, obj.isOutput);
109+
if obj.channelCount>0
110+
status = createBuf(obj);
111+
if status
112+
for k=1:obj.channelCount
113+
disableChannel(obj, obj.channel_names{k}, obj.isOutput);
114+
end
115+
releaseChanBuffers(obj);
116+
cerrmsg(obj,status,['Failed to create buffer for: ' obj.devName]);
117+
return
113118
end
114-
releaseChanBuffers(obj);
115-
cerrmsg(obj,status,['Failed to create buffer for: ' obj.devName]);
116-
return
119+
else
120+
status = 0;
117121
end
118122

119123
end

.gitlab-ci.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ build:master:
3030
- matlab
3131
stage: build
3232
script:
33-
- export HDLBRANCH=master
33+
- export HDLBRANCH=hdl_2018_r2
3434
- export MLRELEASE=R2018b
3535
- ./CI/scripts/dockermake build
3636
- export HDLBRANCH=
@@ -82,17 +82,35 @@ test_installer:2018_R1_Installer:
8282
reports:
8383
junit: test/BSPTestResults.xml
8484

85-
# Test weekly fully sythesized design
86-
test:Synthesize:
87-
when: manual
85+
# Test HWA no install
86+
test:2018_R1:
87+
tags:
88+
- vivado
89+
- matlab
90+
stage: test
91+
dependencies:
92+
- build:2018_R1
93+
script:
94+
- ./CI/scripts/dockermake test
95+
- ./CI/scripts/dockermake zip
96+
artifacts:
97+
when: always
98+
paths:
99+
- zip/
100+
- test/logs/
101+
reports:
102+
junit: test/BSPTestResults.xml
103+
104+
# Test targeting demos (no hardware)
105+
test:targeting_demos:
88106
tags:
89107
- matlab
90108
- vivado
91109
stage: test
92110
dependencies:
93111
- build:2018_R1
94112
script:
95-
- ./CI/scripts/dockermake test_synth
113+
- ./CI/scripts/dockermake test_targeting_demos
96114
artifacts:
97115
when: always
98116
name: "$CI_COMMIT_REF_NAME"

CI/projects/adrv9361z7035/common/config_rx.tcl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,14 @@ disconnect_bd_net /util_ad9361_adc_fifo_dout_data_3 [get_bd_pins util_ad9361_adc
1313
connect_bd_net [get_bd_pins util_ad9361_adc_pack/adc_valid_0] [get_bd_pins util_ad9361_adc_pack/adc_valid_1]
1414
connect_bd_net [get_bd_pins util_ad9361_adc_pack/adc_valid_0] [get_bd_pins util_ad9361_adc_pack/adc_valid_2]
1515
connect_bd_net [get_bd_pins util_ad9361_adc_pack/adc_valid_0] [get_bd_pins util_ad9361_adc_pack/adc_valid_3]
16+
17+
global dma_config
18+
# Configure DMA
19+
if {[info exists dma_config]} {
20+
if {$dma_config eq "Packetized"} {
21+
set_property -dict [list CONFIG.DMA_DATA_WIDTH_SRC {64} CONFIG.DMA_DATA_WIDTH_DEST {256} CONFIG.SYNC_TRANSFER_START {false} CONFIG.DMA_AXI_PROTOCOL_DEST {0} CONFIG.DMA_TYPE_SRC {1} CONFIG.MAX_BYTES_PER_BURST {32768}] [get_bd_cells axi_ad9361_adc_dma]
22+
connect_bd_net [get_bd_pins axi_ad9361_adc_dma/s_axis_aclk] [get_bd_pins util_ad9361_divclk/clk_out]
23+
connect_bd_net [get_bd_pins util_ad9361_adc_pack/adc_data] [get_bd_pins axi_ad9361_adc_dma/s_axis_data]
24+
connect_bd_net [get_bd_pins axi_ad9361_adc_dma/s_axis_valid] [get_bd_pins util_ad9361_adc_pack/adc_valid]
25+
}
26+
}

CI/scripts/Docker

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
FROM ubuntu:16.04
22

33
MAINTAINER Travis Collins <travis.collins@analog.com>
4-
RUN apt update
4+
RUN DEBIAN_FRONTEND=noninteractive apt update
55
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libpng-dev libfreetype6-dev libblas-dev liblapack-dev gfortran build-essential xorg
66
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y openjdk-8-jre openjdk-8-jdk libgtk2.0-0 libxss1 libxt6 zip unzip curl wget tar git xvfb
7+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y fakeroot libncurses5-dev libssl-dev ccache dfu-util u-boot-tools device-tree-compiler
8+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libssl-dev mtools bc python cpio zip unzip rsync file wget
79
RUN DEBIAN_FRONTEND=noninteractive dpkg --add-architecture i386
810
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y lib32stdc++6

CI/scripts/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ test_modem:
9797
test_synth:
9898
bash synth_designs.sh
9999

100+
test_targeting_demos:
101+
bash targeting_designs.sh
102+
100103
gen_tlbx:
101104
${MLPATH}/$(MLRELEASE)/bin/matlab $(MLFLAGS) -r "genTlbx;exit();"
102105

CI/scripts/targeting_designs.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
MLFLAGS="-nodisplay -nodesktop -nosplash"
4+
5+
if [ -z "$MLRELEASE" ]
6+
then
7+
MLRELEASE=R2018b
8+
fi
9+
10+
MLPATH=/usr/local/MATLAB
11+
12+
cd ../..
13+
source /opt/Xilinx/Vivado/2017.4/settings64.sh
14+
Xvfb :77 &
15+
export DISPLAY=:77
16+
export SWT_GTK3=0
17+
source /opt/Xilinx/Vivado/2017.4/settings64.sh
18+
$MLPATH/$MLRELEASE/bin/matlab $MLFLAGS -r "addpath(genpath('test'));addpath(genpath('deps'));runDemoTests;"
19+
kill -9 `pidof Xvfb`
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
function add_rx_tx_io(hRD)
2+
3+
% add AXI4 and AXI4-Lite slave interfaces
4+
hRD.addAXI4SlaveInterface( ...
5+
'InterfaceConnection', 'axi_cpu_interconnect/M11_AXI', ...
6+
'BaseAddress', '0x43C00000', ...
7+
'MasterAddressSpace', 'sys_ps7/Data');
8+
9+
% % AGC control input for transceiver
10+
% hRD.addInternalIOInterface( ...
11+
% 'InterfaceID', 'Enable AGC', ...
12+
% 'InterfaceType', 'OUT', ...
13+
% 'PortName', 'en_agc', ...
14+
% 'PortWidth', 1, ...
15+
% 'InterfaceConnection', 'gpio_en_agc', ...
16+
% 'IsRequired', false);
17+
18+
% GPIO status output for transceiver
19+
hRD.addInternalIOInterface( ...
20+
'InterfaceID', 'CTRL_STATUS', ...
21+
'InterfaceType', 'IN', ...
22+
'PortName', 'gpio_status', ...
23+
'PortWidth', 8, ...
24+
'InterfaceConnection', 'gpio_status', ...
25+
'IsRequired', false);
26+
27+
% GPIO Control input for transceiver
28+
hRD.addInternalIOInterface( ...
29+
'InterfaceID', 'AD9361 CTRL IN', ...
30+
'InterfaceType', 'OUT', ...
31+
'PortName', 'gpio_ctl', ...
32+
'PortWidth', 4, ...
33+
'InterfaceConnection', 'gpio_ctl', ...
34+
'IsRequired', false);
35+
36+
% DMA Ready signal
37+
hRD.addInternalIOInterface( ...
38+
'InterfaceID', 'DMA Ready', ...
39+
'InterfaceType', 'IN', ...
40+
'PortName', 'dma_rdy', ...
41+
'PortWidth', 1, ...
42+
'InterfaceConnection', 'axi_ad9361_adc_dma/s_axis_ready', ...
43+
'IsRequired', false);
44+
45+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46+
% Rx Reference design interfaces
47+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48+
hRD.addInternalIOInterface( ...
49+
'InterfaceID', 'IP Data Valid OUT', ...
50+
'InterfaceType', 'OUT', ...
51+
'PortName', 'dut_data_valid', ...
52+
'PortWidth', 1, ...
53+
'InterfaceConnection', 'util_ad9361_adc_pack/adc_valid_0', ...
54+
'IsRequired', false);
55+
56+
hRD.addInternalIOInterface( ...
57+
'InterfaceID', 'IP Data 0 OUT', ...
58+
'InterfaceType', 'OUT', ...
59+
'PortName', 'dut_data_0', ...
60+
'PortWidth', 16, ...
61+
'InterfaceConnection', 'util_ad9361_adc_pack/adc_data_0', ...
62+
'IsRequired', false);
63+
64+
hRD.addInternalIOInterface( ...
65+
'InterfaceID', 'IP Data 1 OUT', ...
66+
'InterfaceType', 'OUT', ...
67+
'PortName', 'dut_data_1', ...
68+
'PortWidth', 16, ...
69+
'InterfaceConnection', 'util_ad9361_adc_pack/adc_data_1', ...
70+
'IsRequired', false);
71+
72+
hRD.addInternalIOInterface( ...
73+
'InterfaceID', 'IP Data 2 OUT', ...
74+
'InterfaceType', 'OUT', ...
75+
'PortName', 'dut_data_2', ...
76+
'PortWidth', 16, ...
77+
'InterfaceConnection', 'util_ad9361_adc_pack/adc_data_2', ...
78+
'IsRequired', false);
79+
80+
hRD.addInternalIOInterface( ...
81+
'InterfaceID', 'IP Data 3 OUT', ...
82+
'InterfaceType', 'OUT', ...
83+
'PortName', 'dut_data_3', ...
84+
'PortWidth', 16, ...
85+
'InterfaceConnection', 'util_ad9361_adc_pack/adc_data_3', ...
86+
'IsRequired', false);
87+
88+
hRD.addInternalIOInterface( ...
89+
'InterfaceID', 'AD9361 ADC Data I0', ...
90+
'InterfaceType', 'IN', ...
91+
'PortName', 'sys_wfifo_0_dma_wdata', ...
92+
'PortWidth', 16, ...
93+
'InterfaceConnection', 'util_ad9361_adc_fifo/dout_data_0', ...
94+
'IsRequired', false);
95+
96+
hRD.addInternalIOInterface( ...
97+
'InterfaceID', 'AD9361 ADC Data Q0', ...
98+
'InterfaceType', 'IN', ...
99+
'PortName', 'sys_wfifo_1_dma_wdata', ...
100+
'PortWidth', 16, ...
101+
'InterfaceConnection', 'util_ad9361_adc_fifo/dout_data_1', ...
102+
'IsRequired', false);
103+
104+
hRD.addInternalIOInterface( ...
105+
'InterfaceID', 'AD9361 ADC Data I1', ...
106+
'InterfaceType', 'IN', ...
107+
'PortName', 'sys_wfifo_2_dma_wdata', ...
108+
'PortWidth', 16, ...
109+
'InterfaceConnection', 'util_ad9361_adc_fifo/dout_data_2', ...
110+
'IsRequired', false);
111+
112+
hRD.addInternalIOInterface( ...
113+
'InterfaceID', 'AD9361 ADC Data Q1', ...
114+
'InterfaceType', 'IN', ...
115+
'PortName', 'sys_wfifo_3_dma_wdata', ...
116+
'PortWidth', 16, ...
117+
'InterfaceConnection', 'util_ad9361_adc_fifo/dout_data_3', ...
118+
'IsRequired', false);
119+
120+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
121+
% Tx Reference design interfaces
122+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123+
hRD.addInternalIOInterface( ...
124+
'InterfaceID', 'AD9361 DAC Data I0', ...
125+
'InterfaceType', 'OUT', ...
126+
'PortName', 'axi_ad9361_dac_data_i0', ...
127+
'PortWidth', 16, ...
128+
'InterfaceConnection', 'axi_ad9361_dac_fifo/din_data_0', ...
129+
'IsRequired', false);
130+
131+
hRD.addInternalIOInterface( ...
132+
'InterfaceID', 'AD9361 DAC Data Q0', ...
133+
'InterfaceType', 'OUT', ...
134+
'PortName', 'axi_ad9361_dac_data_q0', ...
135+
'PortWidth', 16, ...
136+
'InterfaceConnection', 'axi_ad9361_dac_fifo/din_data_1', ...
137+
'IsRequired', false);
138+
139+
hRD.addInternalIOInterface( ...
140+
'InterfaceID', 'AD9361 DAC Data I1', ...
141+
'InterfaceType', 'OUT', ...
142+
'PortName', 'axi_ad9361_dac_data_i1', ...
143+
'PortWidth', 16, ...
144+
'InterfaceConnection', 'axi_ad9361_dac_fifo/din_data_2', ...
145+
'IsRequired', false);
146+
147+
hRD.addInternalIOInterface( ...
148+
'InterfaceID', 'AD9361 DAC Data Q1', ...
149+
'InterfaceType', 'OUT', ...
150+
'PortName', 'axi_ad9361_dac_data_q1', ...
151+
'PortWidth', 16, ...
152+
'InterfaceConnection', 'axi_ad9361_dac_fifo/din_data_3', ...
153+
'IsRequired', false);
154+
155+
hRD.addInternalIOInterface( ...
156+
'InterfaceID', 'IP Data 0 IN', ...
157+
'InterfaceType', 'IN', ...
158+
'PortName', 'util_dac_unpack_dac_data_00', ...
159+
'PortWidth', 16, ...
160+
'InterfaceConnection', 'util_ad9361_dac_upack/dac_data_0', ...
161+
'IsRequired', false);
162+
163+
hRD.addInternalIOInterface( ...
164+
'InterfaceID', 'IP Data 1 IN', ...
165+
'InterfaceType', 'IN', ...
166+
'PortName', 'util_dac_unpack_dac_data_01', ...
167+
'PortWidth', 16, ...
168+
'InterfaceConnection', 'util_ad9361_dac_upack/dac_data_1', ...
169+
'IsRequired', false);
170+
171+
hRD.addInternalIOInterface( ...
172+
'InterfaceID', 'IP Data 2 IN', ...
173+
'InterfaceType', 'IN', ...
174+
'PortName', 'util_dac_unpack_dac_data_02', ...
175+
'PortWidth', 16, ...
176+
'InterfaceConnection', 'util_ad9361_dac_upack/dac_data_2', ...
177+
'IsRequired', false);
178+
179+
hRD.addInternalIOInterface( ...
180+
'InterfaceID', 'IP Data 3 IN', ...
181+
'InterfaceType', 'IN', ...
182+
'PortName', 'util_dac_unpack_dac_data_03', ...
183+
'PortWidth', 16, ...
184+
'InterfaceConnection', 'util_ad9361_dac_upack/dac_data_3', ...
185+
'IsRequired', false);
186+
187+
hRD.addInternalIOInterface( ...
188+
'InterfaceID', 'IP Load Tx Data OUT', ...
189+
'InterfaceType', 'OUT', ...
190+
'PortName', 'util_dac_unpack_dac_valid_00', ...
191+
'PortWidth', 1, ...
192+
'InterfaceConnection', 'util_ad9361_dac_upack/dac_valid_0', ...
193+
'IsRequired', false);
194+
195+
hRD.addInternalIOInterface( ...
196+
'InterfaceID', 'IP Valid Tx Data IN', ...
197+
'InterfaceType', 'IN', ...
198+
'PortName', 'util_dac_unpack_upack_valid_00', ...
199+
'PortWidth', 1, ...
200+
'InterfaceConnection', 'util_ad9361_dac_upack/upack_valid_0', ...
201+
'IsRequired', false);

0 commit comments

Comments
 (0)