Forum Discussion
MAYLIS
New Contributor
5 years agoMAX10 ADC (Quartus)
Hi, I configured the ADC of the MAX10 on Quartus, I powered it but I am stuck in the initialization of this last one, I wrote a code to initialize it but I still cannot have the data. It's in sample_...
Ash_R_Altera
Regular Contributor
5 years agoHi MAYLIS,
I have difficulty understanding the term 'initialization'. To initialize means bit 0 of CMD register = '1' i.e. Run?
https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/hb/max-10/ug_m10_adc.pdf
Regards.
- MAYLIS5 years ago
New Contributor
Hello !!
Thanks for your reply. Exactly, to run it, I have to set bit 0 to 1, I am attaching a screenshot of the datasheet.
Here is my code for the initialization, I put also the sample_read to 1 so that I can activate data reading that I will recover them then with a PIO, but I still don't succeed I don't know the error it comes from where :
library IEEE;use IEEE.std_logic_1164.all;use IEEE.numeric_std.all;--------------------------------------------------------------------------------------------------------------entity data_initialisation isport(clk : in std_logic;sequencer_address : out std_logic := 'X'; -- addresssequencer_read : out std_logic := 'X'; -- readsequencer_write : out std_logic := 'X'; -- writesequencer_writedata : out std_logic_vector(31 downto 0) := (others => 'X'); -- writedata-- sequencer_readdata : in std_logic_vector(31 downto 0) ; -- readdatasample_store_address : out std_logic_vector(6 downto 0) := (others => 'X'); -- addresssample_store_read : out std_logic := 'X'; -- readsample_store_write : out std_logic := 'X'; -- write--sample_store_writedata : out std_logic_vector(31 downto 0) := (others => 'X'); -- writedatasample_store_readdata : in std_logic_vector(31 downto 0) -- readdata);end entity data_initialisation;--------------------------------------------------------------------------------------------------------------architecture behavioral of data_initialisation issignal register_samples : std_logic_vector(31 downto 0);signal sequencer_readdata : std_logic_vector(31 downto 0) ; -- readdatasignal sample_store_writedata : std_logic_vector(31 downto 0) := (others => 'X'); -- writedatatype seq_FSM_state_machine is (idle, write_CSR_sequencer, read_samples);signal seq_FSM : seq_FSM_state_machine := idle;beginseq : process ( clk)beginif clk'event and clk = '1' thencase seq_FSM iswhen idle =>seq_FSM <= write_CSR_sequencer;when write_CSR_sequencer =>seq_FSM <= read_samples;when read_samples =>seq_FSM <= read_samples;end case;end if;end process;process ( seq_FSM)begincase seq_FSM iswhen idle =>sequencer_address <= '0';sequencer_read <= '0';sequencer_write <= '0';sequencer_writedata <= (others => '0');sample_store_address <= std_logic_vector(to_unsigned (16#0000#, sample_store_address'length));sample_store_read <= '0';sample_store_write <= '0';when write_CSR_sequencer =>sequencer_address <= '0';sequencer_read <= '0';sequencer_write <= '1';sequencer_writedata <= x"00000001";when read_samples =>sample_store_address <= std_logic_vector(to_unsigned (16#0000#, sample_store_address'length));sample_store_read <= '1';register_samples <= sample_store_readdata ;sample_store_write <= '0';when others =>sequencer_address <= '0';sequencer_read <= '0';sequencer_write <= '0';sequencer_writedata <= (others => '0');sample_store_address <= std_logic_vector(to_unsigned (16#0000#, sample_store_address'length));sample_store_read <= '0';sample_store_write <= '0';end case;end process;end architecture behavioral;To read data with the PIO, I just put an IORD of the PIO on eclipse, I don't know if this is what I should do or it is necessary to write a function to increase the addresses by 4 and after reading the value.Thanks in advance.Regards,