Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

vhdl dpi dac with DE1-SOC Board

Status
Not open for further replies.

jimmykk

Full Member level 3
Joined
Oct 2, 2014
Messages
158
Helped
0
Reputation
0
Reaction score
1
Trophy points
1,298
Activity points
2,863
Hi
i need some help with communicating to SPI DAC 5641 THROUGH DE1 SOC ALTERA board, in vhdl. i have written some code but it is not working. i have to send 14- bit digital data from FPGA and obtain analog voltage at off board DAC OUTPUT. i am using GPIO bus to get the outputs on oscilloscope.



Code VHDL - [expand]
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
--use IEEE.STD_LOGIC_ARITH.ALL;
--use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity waveforms is 
port( 
      CLOCK_50      : in  std_logic;  
      --cs       : out std_logic;  
     -- sck      : out std_logic;   
        --sdi      : out std_logic
        --GPIO_1  : INOUT STD_logic_vector(0 DOWNTO 0) := "1";
        GPIO_1     :     INOUT STD_LOGIC_vector(35 DOWNTO 0)
        --GPIO_1[1]     : inout std_logic := '0';
        --GPIO_1[2]     : inout std_logic := '0';
     -- GPIO_1[3]     : inout std_logic := '0'
 
        );  
end waveforms;
 
architecture Behavioral of waveforms is
 
-signal turn     : std_logic := '0';   --*
signal data : std_logic_vector(0 TO 15) := "0011110011001100";     -- := X"3FFF";
begin
 
process(CLOCK_50)
 
variable i,k:integer:=0;
begin
if (falling_edge(CLOCK_50)) then
 
i:=i+1;
 
 
if i<65 then
GPIO_1(0)<='0';
else 
GPIO_1(0)<='1';
end if;
 
 
if i<3 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<5 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
k:=k+1;
 
elsif i<7 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<9 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
 
elsif i<11 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<13 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
 
elsif i<15 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<17 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
 
elsif i<19 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<21 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
 
elsif i<23 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<25 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
 
elsif i<27 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<29 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
 
elsif i<31 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<33 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
 
elsif i<35 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<37 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
 
elsif i<39 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<41 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
 
elsif i<43 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<45 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
 
elsif i<47 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<49 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
 
elsif i<51 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<53 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
 
elsif i<55 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<57 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
 
elsif i<59 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<61 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
 
elsif i<63 then
GPIO_1(1)<='0';
GPIO_1(2)<=data(k);
elsif i<65 then
GPIO_1(1)<='1';
GPIO_1(2)<=data(k);
K:=k+1;
elsif i = 127 then
i := 0;
end if;
end if;
end process;
 
 
GPIO_1(3) <= turn;
end Behavioral;

 
Last edited by a moderator:

How do you expect this to work? It's not even written in a way that describes hardware. VHDL is a hardware description language, you've written this like software. I'm not even going to try and figure out what you are trying to do.

Besides that you say it doesn't work, what doesn't work? You aren't being very specific about your problem.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top