cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
1,763 Views
Registered: ‎03-25-2014

NPI read problems

I have problem when I'm trying to read from my DDR2 ram.

 

Somehow I end up with always reading from the last memory location that I used in sdk, instead of the one that I send out from the EDK.

 

example of my sofware code:

 

	xil_printf("initialize\n\r"); //put value in memory location 0xD8002000 until 0xD8002044 
		writeLoc=(u32*)0xD8002000;
		*writeLoc=value;
		while (writeLoc<=(u32*)0xD8002040){
					//	xil_printf("value 0x%08X at 0x%08X\n\r",*writeLoc, writeLoc);
						value=value+1;
						writeLoc = writeLoc+1;
						*writeLoc=value;
						}
		readLoc=writeLoc;
		xil_printf("check npi read\n\r");
		xil_printf("value 0x%08X at 0x%08X\n\r",*readLoc, readLoc);

		xil_printf("check here if you only read from address where you have written to in sf for the last time!\n\r");
		for (i=0; i<50;i++){
		xil_printf("value 0x%08X at 0x%08X\n\r",*readLoc, readLoc);
		*ptr_rd_slv2=0x0;
		read_test();
		*readLoc=*readLoc+1;
		}

 

Output in terminal: I always read out from memory location 0xD8002044(which is the last location that I wrote to via software).

To check what I read out at which memory location via NPI, I send the RdFIFO_data en addr to a register that I read out via software (in read_test function). 

 

This is the EDK part where I change the address where I want to write to.

process(old_state, sel) -- output fsm
constant addra :integer:=216;--D80
variable addr_cam :integer:=8192;--02000
variable addr_sob_a :integer:=1241088;--12F000;
variable addr_sob_b :integer:=1243904;--12FB00;
variable camIn_counter: integer range 0 to 307200;
variable sobel_a_counter: integer range 0 to 640;
variable sobel_b_counter: integer range 0 to 640;
variable address: integer := 8192;


begin
--check what to read
case sel is
		when "000" =>  --read to sobel, the data is saved data from camera
				if  addr_cam<=1236992 then
				addr_cam:=addr_cam+4;
			else
				addr_cam:=8192;
			end if;			
				addr <= conv_std_logic_vector(addra,8)&conv_std_logic_vector(addr_cam,24);--
		when "001" =>  --read to parallax, data is saved data from sobel A
			if addr_sob_a <1243648 then
				addr_sob_a:=addr_sob_a+4;				
			else
				addr_sob_a:=1241088;
			end if;		
			addr <= conv_std_logic_vector(addra,8)&conv_std_logic_vector(addr_sob_a,24);--start to write the camera a sobel data D8012000
		when "010" => 
		if addr_sob_b <1246464 then
				addr_sob_b:=addr_sob_b+4;				
			else
				addr_sob_b:=1243904;
			end if;		
			addr <= conv_std_logic_vector(addra,8)&conv_std_logic_vector(addr_sob_b,24);--start to write the camera b sobel data D8012000
		when others => 
			addr <= "11011111111111111111111111111111"; --DFFFFFFF
	end case;
--	if address <= 8242 then
--	address := address+4;
--	else
--		address:=8192;
--		end if;
-- addr<=conv_std_logic_vector(addra,8)&conv_std_logic_vector(address,24);
--check fsm state outputs
	case old_state is
		when Startup =>AddrReq<= '0';
							RdFIFO_Pop <= '0';
							Done<='0';
							
		when idle => 	AddrReq<= '0';
							RdFIFO_Pop <= '0';
							Done<='0';
							
		when Rd_Addr_Req =>
							AddrReq<= '1';
							RdFIFO_Pop <= '0';
							Done<='0';
							
		when RdFIFO_Not_Empty =>
							AddrReq<= '0';
							RdFIFO_Pop <= '1';
							Done <='0';
							
		when Rd_Pop => 
							AddrReq<= '0';
							RdFIFO_Pop <= '0';
							Done<='1';

--							
		when Rd_Lat1_Pop =>
							AddrReq<= '0';
							RdFIFO_Pop <= '1';
							Done<='0';
							
		when Rd_Lat1_Data =>
							AddrReq<= '0';
							RdFIFO_Pop <= '0';
							Done<='1';

							
		when Rd_Lat2_Pop =>
							AddrReq<= '0';
							RdFIFO_Pop <= '1';
							Done<='0';
							
		when Rd_Lat2_Wait =>
							AddrReq<= '0';
							RdFIFO_Pop <= '0';
							Done<='0';								
									
		when Rd_Lat2_Data =>
							AddrReq<= '0';
							RdFIFO_Pop <= '1';
							Done<='1';
							
		when others =>							
							AddrReq<= '0';
							RdFIFO_Pop <= '0';
							Done<='0';	
	end case;
end process;

 

 

 

Can anyone help me find my mistake?

Tags (5)
0 Kudos
0 Replies