I'm new to FPGA and VHDL. I'm working on lab practical and for the practical we were already given file that has an I2C codec and the basics for the codec registers were already done but I found the given files were too complicated and I couldn't understand it; they were things like slave and masters. So I decided to follow an online tutorial.
I am using a DE0-Nano board. I want to make three different waves (sound) so I followed an online tutorial to make sine wave, but when I tested it on my board nothing happened, and I didn't get any sound. Is there something missing on my code or did I assign to the wrong pins? Here is the documentation for the board just in case you need it.
I would also appreciate if you can also tell me about any source that will help me understand I2C and the slave/master.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity sinewave is
port (
clk :in std_logic; -- I tried connecting it to PIN_B14 & PIN_R8
dataout : out integer range -128 to 127 -- connect to PIN_A9
);
end sinewave;
architecture Audio of sinewave is
signal i : integer range 0 to 30:=0;
type memory_type is array (0 to 29) of integer range -128 to 127;
signal sine : memory_type := (0,16,31,45,58,67,74,77,77,74,67,58,45,31,16,0,
-16,-31,-45,-58,-67,-74,-77,-77,-74,-67,-58,-45,-31,-16);
begin
process(clk)
begin
if(rising_edge(clk)) then
dataout <= sine(i);
i <= i+ 1;
if(i = 29) then
i <= 0;
end if;
end if;
end process;
end Audio;
clk
? What pins did you assign? I don't think your audio chip accepts raw binary values. \$\endgroup\$