News:

Attention: For security reasons,please choose a user name *different* from your login name.
Also make sure to choose a secure password and change it regularly.

Main Menu

ddr on TE-600

Started by davidov, February 18, 2013, 05:20:49 PM

Previous topic - Next topic

davidov

Hello,

I created project in XPS with UARTlite,DDR3 and GPIO (Xilinx ISE 14.3)
and i want get data from Uart to  DDR, after send data.
But i have problems with ddr.
test DDR code :

#include <stdio.h>
#include "platform.h"
#include "xparameters.h"
#include "xuartlite.h"
#include "xuartlite_l.h"
#include "xil_exception.h"
#include "xgpio.h"
void print(char *str);
XGpio leds;
XUartLite rxtx;
u8 *DDR = (u8 *)XPAR_S6DDR_0_S0_AXI_BASEADDR;
u32 k=0;
int main()
{
init_platform();
XUartLite_Initialize(&rxtx,XPAR_AXI_UARTLITE_0_DEVICE_ID);
XGpio_Initialize(&leds, XPAR_AXI_GPIO_0_DEVICE_ID);
XGpio_SetDataDirection(&leds,1,0);
XGpio_DiscreteWrite(&leds,1,15);
u32 f=0;
for (f=0;f<7000;f++)//not out of the cycle
{
   DDR[f]=f;
   XGpio_DiscreteWrite(&leds,1,9);
}

u8 good_test=1;
for (f=0;f<7000;f++)
{
  if  (DDR[f]!=f)
  {XGpio_DiscreteWrite(&leds,1,5);good_test=0;}

}
if(good_test==1)
{
while(1)
{
XGpio_DiscreteWrite(&leds,1,5);
for (f=0;f<1000000;f++){;}
XGpio_DiscreteWrite(&leds,1,10);
for (f=0;f<1000000;f++){;}
}
}
else
{
while(1)
{
XGpio_DiscreteWrite(&leds,1,6);
for (f=0;f<1000000;f++){;}
XGpio_DiscreteWrite(&leds,1,3);
for (f=0;f<1000000;f++){;}
}
}

     cleanup_platform();
    return 0;
}


if debug code(press f6 every step), then first cycle work good, but if resume then programm not work correctly.
system.ucf:

NET "CLK" TNM_NET = sys_clk_pin;
TIMESPEC TS_sys_clk_pin = PERIOD sys_clk_pin 125000 kHz;
NET  "CLK"                              LOC = "AA12" ;
NET  "CLK"                                IOSTANDARD = LVCMOS33;
Net"MCB_DDR3_dram_addr[*]" IOSTANDARD = SSTL15_II;
Net"MCB_DDR3_dram_addr[0]"                              LOC = "F21";
Net"MCB_DDR3_dram_addr[1]"                              LOC = "F22";
Net"MCB_DDR3_dram_addr[2]"                              LOC = "E22";
Net"MCB_DDR3_dram_addr[3]"                              LOC = "G20";
Net"MCB_DDR3_dram_addr[4]"                              LOC = "F20";
Net"MCB_DDR3_dram_addr[5]"                              LOC = "K20";
Net"MCB_DDR3_dram_addr[6]"                              LOC = "K19";
Net"MCB_DDR3_dram_addr[7]"                              LOC = "E20";
Net"MCB_DDR3_dram_addr[8]"                              LOC = "C20";
Net"MCB_DDR3_dram_addr[9]"                              LOC = "C22";
Net"MCB_DDR3_dram_addr[10]"                            LOC = "G19";
Net"MCB_DDR3_dram_addr[11]"                            LOC = "F19";
Net"MCB_DDR3_dram_addr[12]"                            LOC = "D22";
Net "MCB_DDR3_dram_ba[*]"                                IOSTANDARD = SSTL15_II;
Net "MCB_DDR3_dram_ba[0]"                                LOC = "J17";
Net "MCB_DDR3_dram_ba[1]"                                LOC = "K17";
Net "MCB_DDR3_dram_ba[2]"                                LOC = "H18";
Net "MCB_DDR3_dram_cas_n"                               IOSTANDARD = SSTL15_II;
Net "MCB_DDR3_dram_cas_n"                               LOC="H22";
Net "MCB_DDR3_dram_cke"                                   IOSTANDARD = SSTL15_II;
Net "MCB_DDR3_dram_cke"                                   LOC="D21";
Net "MCB_DDR3_dram_clk"                IOSTANDARD = DIFF_SSTL15_II;
Net "MCB_DDR3_dram_clk"                                    LOC = "H20" ;
Net "MCB_DDR3_dram_clk_n"        IOSTANDARD = DIFF_SSTL15_II;
Net "MCB_DDR3_dram_clk_n"        LOC = "J19" ;
Net "MCB_DDR3_dram_ddr3_rst"        IOSTANDARD =  LVCMOS15;
Net "MCB_DDR3_dram_ddr3_rst"        LOC = "F18" ;
NET  "MCB_DDR3_dram_dq[*]"                              IOSTANDARD = SSTL15_II;
NET  "MCB_DDR3_dram_dq[0]"                              LOC = "N20" ;
NET  "MCB_DDR3_dram_dq[10]"                            LOC = "R20" ;
NET  "MCB_DDR3_dram_dq[11]"                            LOC = "R22" ;
NET  "MCB_DDR3_dram_dq[12]"                            LOC = "U20" ;
NET  "MCB_DDR3_dram_dq[13]"                            LOC = "U22" ;
NET  "MCB_DDR3_dram_dq[14]"                            LOC = "V21" ;
NET  "MCB_DDR3_dram_dq[15]"                            LOC = "V22" ;
NET  "MCB_DDR3_dram_dq[1]"                              LOC = "N22" ;
NET  "MCB_DDR3_dram_dq[2]"                              LOC = "M21" ;
NET  "MCB_DDR3_dram_dq[3]"                              LOC = "M22" ;
NET  "MCB_DDR3_dram_dq[4]"                              LOC = "J20" ;
NET  "MCB_DDR3_dram_dq[5]"                              LOC = "J22" ;
NET  "MCB_DDR3_dram_dq[6]"                              LOC = "K21" ;
NET  "MCB_DDR3_dram_dq[7]"                              LOC = "K22" ;
NET  "MCB_DDR3_dram_dq[8]"                              LOC = "P21" ;
NET  "MCB_DDR3_dram_dq[9]"                              LOC = "P22" ;
NET  "MCB_DDR3_dram_dqs"                                 LOC = "L20" ;
NET  "MCB_DDR3_dram_dqs"                                 IOSTANDARD = DIFF_SSTL15_II;
NET  "MCB_DDR3_dram_dqs_n"                             LOC = "L22" ;
NET  "MCB_DDR3_dram_dqs_n"                             IOSTANDARD = DIFF_SSTL15_II;
NET  "MCB_DDR3_dram_ldm"                                 LOC = "L19" ;
NET  "MCB_DDR3_dram_ldm"                                 IOSTANDARD = SSTL15_II;
NET  "MCB_DDR3_dram_odt"                                 LOC = "G22" ;
NET  "MCB_DDR3_dram_odt"                                 IOSTANDARD = SSTL15_II;
NET  "MCB_DDR3_dram_ras_n"                             LOC = "H21" ;
NET  "MCB_DDR3_dram_ras_n"                             IOSTANDARD = SSTL15_II;
NET  "MCB_DDR3_dram_udm"                               LOC = "M20" ;
NET  "MCB_DDR3_dram_udm"                               IOSTANDARD = SSTL15_II;
NET  "MCB_DDR3_dram_udqs"                              LOC = "T21" ;
NET  "MCB_DDR3_dram_udqs"                              IOSTANDARD = DIFF_SSTL15_II;
NET  "MCB_DDR3_dram_udqs_n"                          LOC = "T22" ;
NET  "MCB_DDR3_dram_udqs_n"                          IOSTANDARD = DIFF_SSTL15_II;
NET  "MCB_DDR3_dram_we_n"                             LOC = "H19" ;
NET  "MCB_DDR3_dram_we_n"                             IOSTANDARD = SSTL15_II;
NET  "MCB_DDR3_rzq"                                      LOC = "M19" ;
NET  "MCB_DDR3_rzq"                                        IOSTANDARD = SSTL15_II;
NET  "MCB_DDR3_zio"                                        LOC = "C19" ;
NET  "MCB_DDR3_zio"                                        IOSTANDARD = SSTL15_II;
NET  "axi_gpio_0_GPIO_IO_O_pin[0]"                  IOSTANDARD = LVCMOS15;
NET  "axi_gpio_0_GPIO_IO_O_pin[1]"                  IOSTANDARD = LVCMOS15;
NET  "axi_gpio_0_GPIO_IO_O_pin[2]"                  IOSTANDARD = LVCMOS15;
NET  "axi_gpio_0_GPIO_IO_O_pin[3]"                  IOSTANDARD = LVCMOS15;
NET  "axi_gpio_0_GPIO_IO_O_pin[0]"                  LOC = "H8" ;
NET  "axi_gpio_0_GPIO_IO_O_pin[1]"                  LOC = "J7" ;
NET  "axi_gpio_0_GPIO_IO_O_pin[2]"                  LOC = "T4" ;
NET  "axi_gpio_0_GPIO_IO_O_pin[3]"                  LOC = "T3" ;
NET "MCB_DDR3_dram_dq[*]"                              IN_TERM = NONE;
NET "MCB_DDR3_dram_dqs"                                 IN_TERM = NONE;
NET "MCB_DDR3_dram_dqs_n"                             IN_TERM = NONE;
NET "MCB_DDR3_dram_udqs"                               IN_TERM = NONE;
NET "MCB_DDR3_dram_udqs_n"                           IN_TERM = NONE;
NET "axi_uartlite_0_RX_pin"       LOC=U16;
NET "axi_uartlite_0_TX_pin"       LOC=U17;
NET "axi_uartlite_0_RX_pin"       IOSTANDARD = LVCMOS33;
NET "axi_uartlite_0_TX_pin"       IOSTANDARD = LVCMOS33;

msh:


# ##############################################################################
# Created by Base System Builder Wizard for Xilinx EDK 14.3 Build EDK_P.40xd
# Fri Feb 15 16:23:39 2013
# Target Board:  Custom
# Family:    spartan6
# Device:    xc6slx150
# Package:   fgg484
# Speed Grade:  -3
# ##############################################################################
PARAMETER VERSION = 2.1.0


PORT MCB_DDR3_zio = MCB_DDR3_zio, DIR = IO
PORT MCB_DDR3_rzq = MCB_DDR3_rzq, DIR = IO
PORT MCB_DDR3_dram_we_n = MCB_DDR3_dram_we_n, DIR = O
PORT MCB_DDR3_dram_udqs_n = MCB_DDR3_dram_udqs_n, DIR = IO
PORT MCB_DDR3_dram_udqs = MCB_DDR3_dram_udqs, DIR = IO
PORT MCB_DDR3_dram_udm = MCB_DDR3_dram_udm, DIR = O
PORT MCB_DDR3_dram_ras_n = MCB_DDR3_dram_ras_n, DIR = O
PORT MCB_DDR3_dram_odt = MCB_DDR3_dram_odt, DIR = O
PORT MCB_DDR3_dram_ldm = MCB_DDR3_dram_ldm, DIR = O
PORT MCB_DDR3_dram_dqs_n = MCB_DDR3_dram_dqs_n, DIR = IO
PORT MCB_DDR3_dram_dqs = MCB_DDR3_dram_dqs, DIR = IO
PORT MCB_DDR3_dram_dq = MCB_DDR3_dram_dq, DIR = IO, VEC = [15:0]
PORT MCB_DDR3_dram_ddr3_rst = MCB_DDR3_dram_ddr3_rst, DIR = O
PORT MCB_DDR3_dram_clk_n = MCB_DDR3_dram_clk_n, DIR = O, SIGIS = CLK
PORT MCB_DDR3_dram_clk = MCB_DDR3_dram_clk, DIR = O, SIGIS = CLK
PORT MCB_DDR3_dram_cke = MCB_DDR3_dram_cke, DIR = O
PORT MCB_DDR3_dram_cas_n = MCB_DDR3_dram_cas_n, DIR = O
PORT MCB_DDR3_dram_ba = MCB_DDR3_dram_ba, DIR = O, VEC = [2:0]
PORT MCB_DDR3_dram_addr = MCB_DDR3_dram_addr, DIR = O, VEC = [12:0]
PORT CLK = CLK, DIR = I, SIGIS = CLK, CLK_FREQ = 125000000
PORT axi_uartlite_0_RX_pin = axi_uartlite_0_RX, DIR = I
PORT axi_uartlite_0_TX_pin = axi_uartlite_0_TX, DIR = O
PORT axi_gpio_0_GPIO_IO_O_pin = axi_gpio_0_GPIO_IO_O, DIR = O, VEC = [3:0]


BEGIN proc_sys_reset
PARAMETER INSTANCE = proc_sys_reset_0
PARAMETER HW_VER = 3.00.a
PARAMETER C_EXT_RESET_HIGH = 1
PORT MB_Debug_Sys_Rst = proc_sys_reset_0_MB_Debug_Sys_Rst
PORT Dcm_locked = proc_sys_reset_0_Dcm_locked
PORT MB_Reset = proc_sys_reset_0_MB_Reset
PORT Slowest_sync_clk = clk_100_0000MHzPLL0
PORT Interconnect_aresetn = proc_sys_reset_0_Interconnect_aresetn
PORT Ext_Reset_In = net_gnd
PORT BUS_STRUCT_RESET = proc_sys_reset_0_BUS_STRUCT_RESET
END

BEGIN lmb_v10
PARAMETER INSTANCE = microblaze_0_ilmb
PARAMETER HW_VER = 2.00.b
PORT SYS_RST = proc_sys_reset_0_BUS_STRUCT_RESET
PORT LMB_CLK = clk_50_0000MHzPLL0
END

BEGIN lmb_bram_if_cntlr
PARAMETER INSTANCE = microblaze_0_i_bram_ctrl
PARAMETER HW_VER = 3.10.b
PARAMETER C_BASEADDR = 0x00000000
PARAMETER C_HIGHADDR = 0x00003fff
BUS_INTERFACE SLMB = microblaze_0_ilmb
BUS_INTERFACE BRAM_PORT = microblaze_0_i_bram_ctrl_2_microblaze_0_bram_block
END

BEGIN lmb_v10
PARAMETER INSTANCE = microblaze_0_dlmb
PARAMETER HW_VER = 2.00.b
PORT SYS_RST = proc_sys_reset_0_BUS_STRUCT_RESET
PORT LMB_CLK = clk_50_0000MHzPLL0
END

BEGIN lmb_bram_if_cntlr
PARAMETER INSTANCE = microblaze_0_d_bram_ctrl
PARAMETER HW_VER = 3.10.b
PARAMETER C_BASEADDR = 0x00000000
PARAMETER C_HIGHADDR = 0x00003fff
BUS_INTERFACE SLMB = microblaze_0_dlmb
BUS_INTERFACE BRAM_PORT = microblaze_0_d_bram_ctrl_2_microblaze_0_bram_block
END

BEGIN bram_block
PARAMETER INSTANCE = microblaze_0_bram_block
PARAMETER HW_VER = 1.00.a
BUS_INTERFACE PORTA = microblaze_0_i_bram_ctrl_2_microblaze_0_bram_block
BUS_INTERFACE PORTB = microblaze_0_d_bram_ctrl_2_microblaze_0_bram_block
END

BEGIN microblaze
PARAMETER INSTANCE = microblaze_0
PARAMETER HW_VER = 8.40.b
PARAMETER C_INTERCONNECT = 2
PARAMETER C_USE_BARREL = 1
PARAMETER C_USE_FPU = 0
PARAMETER C_DEBUG_ENABLED = 1
PARAMETER C_ICACHE_BASEADDR = 0xa8000000
PARAMETER C_ICACHE_HIGHADDR = 0xafffffff
PARAMETER C_USE_ICACHE = 1
PARAMETER C_CACHE_BYTE_SIZE = 8192
PARAMETER C_ICACHE_ALWAYS_USED = 1
PARAMETER C_DCACHE_BASEADDR = 0xa8000000
PARAMETER C_DCACHE_HIGHADDR = 0xafffffff
PARAMETER C_USE_DCACHE = 1
PARAMETER C_DCACHE_BYTE_SIZE = 8192
PARAMETER C_DCACHE_ALWAYS_USED = 1
BUS_INTERFACE ILMB = microblaze_0_ilmb
BUS_INTERFACE DLMB = microblaze_0_dlmb
BUS_INTERFACE M_AXI_DP = axi4lite_0
BUS_INTERFACE M_AXI_DC = axi4_0
BUS_INTERFACE M_AXI_IC = axi4_0
BUS_INTERFACE DEBUG = microblaze_0_debug
PORT MB_RESET = proc_sys_reset_0_MB_Reset
PORT CLK = clk_50_0000MHzPLL0
END

BEGIN mdm
PARAMETER INSTANCE = debug_module
PARAMETER HW_VER = 2.10.a
PARAMETER C_INTERCONNECT = 2
PARAMETER C_USE_UART = 1
PARAMETER C_BASEADDR = 0x41400000
PARAMETER C_HIGHADDR = 0x4140ffff
BUS_INTERFACE S_AXI = axi4lite_0
BUS_INTERFACE MBDEBUG_0 = microblaze_0_debug
PORT Debug_SYS_Rst = proc_sys_reset_0_MB_Debug_Sys_Rst
PORT S_AXI_ACLK = clk_100_0000MHzPLL0
END

BEGIN clock_generator
PARAMETER INSTANCE = clock_generator_0
PARAMETER HW_VER = 4.03.a
PARAMETER C_CLKIN_FREQ = 125000000
PARAMETER C_CLKOUT0_FREQ = 600000000
PARAMETER C_CLKOUT0_GROUP = PLL0
PARAMETER C_CLKOUT0_BUF = FALSE
PARAMETER C_CLKOUT1_FREQ = 600000000
PARAMETER C_CLKOUT1_PHASE = 180
PARAMETER C_CLKOUT1_GROUP = PLL0
PARAMETER C_CLKOUT1_BUF = FALSE
PARAMETER C_CLKOUT2_FREQ = 100000000
PARAMETER C_CLKOUT2_GROUP = PLL0
PARAMETER C_CLKOUT0_DUTY_CYCLE = 0.500000
PARAMETER C_CLKOUT0_PHASE = 0
PARAMETER C_CLKOUT1_DUTY_CYCLE = 0.500000
PARAMETER C_CLKOUT2_BUF = TRUE
PARAMETER C_CLKOUT2_DUTY_CYCLE = 0.500000
PARAMETER C_CLKOUT2_PHASE = 0
PARAMETER C_CLKOUT3_BUF = TRUE
PARAMETER C_CLKOUT3_DUTY_CYCLE = 0.500000
PARAMETER C_CLKOUT3_FREQ = 50000000
PARAMETER C_CLKOUT3_GROUP = PLL0
PARAMETER C_CLKOUT3_PHASE = 0
PORT LOCKED = proc_sys_reset_0_Dcm_locked
PORT CLKOUT2 = clk_100_0000MHzPLL0
PORT RST = net_gnd
PORT CLKOUT0 = clk_600_0000MHzPLL0_nobuf
PORT CLKOUT1 = clk_600_0000MHz180PLL0_nobuf
PORT CLKIN = CLK
PORT CLKOUT3 = clk_50_0000MHzPLL0
END

BEGIN axi_interconnect
PARAMETER INSTANCE = axi4lite_0
PARAMETER HW_VER = 1.06.a
PARAMETER C_INTERCONNECT_CONNECTIVITY_MODE = 0
PORT INTERCONNECT_ARESETN = proc_sys_reset_0_Interconnect_aresetn
PORT INTERCONNECT_ACLK = clk_100_0000MHzPLL0
END

BEGIN axi_interconnect
PARAMETER INSTANCE = axi4_0
PARAMETER HW_VER = 1.06.a
PORT interconnect_aclk = clk_100_0000MHzPLL0
PORT INTERCONNECT_ARESETN = proc_sys_reset_0_Interconnect_aresetn
END

BEGIN axi_s6_ddrx
PARAMETER INSTANCE = MCB_DDR3
PARAMETER HW_VER = 1.06.a
PARAMETER C_MCB_RZQ_LOC = C19
PARAMETER C_MCB_ZIO_LOC = M19
PARAMETER C_MEM_PARTNO = MT41J64M16XX-187E
PARAMETER C_INTERCONNECT_S0_AXI_MASTERS = microblaze_0.M_AXI_DC & microblaze_0.M_AXI_IC
PARAMETER C_INTERCONNECT_S0_AXI_AW_REGISTER = 8
PARAMETER C_INTERCONNECT_S0_AXI_AR_REGISTER = 8
PARAMETER C_INTERCONNECT_S0_AXI_W_REGISTER = 8
PARAMETER C_INTERCONNECT_S0_AXI_R_REGISTER = 8
PARAMETER C_INTERCONNECT_S0_AXI_B_REGISTER = 8
PARAMETER C_MCB_LOC = MEMC1
PARAMETER C_MCB_PERFORMANCE = EXTENDED
PARAMETER C_S0_AXI_STRICT_COHERENCY = 0
PARAMETER C_S0_AXI_BASEADDR = 0xa8000000
PARAMETER C_S0_AXI_HIGHADDR = 0xafffffff
BUS_INTERFACE S0_AXI = axi4_0
PORT s0_axi_aclk = clk_100_0000MHzPLL0
PORT ui_clk = clk_100_0000MHzPLL0
PORT zio = MCB_DDR3_zio
PORT sysclk_2x = clk_600_0000MHzPLL0_nobuf
PORT sysclk_2x_180 = clk_600_0000MHz180PLL0_nobuf
PORT rzq = MCB_DDR3_rzq
PORT mcbx_dram_we_n = MCB_DDR3_dram_we_n
PORT mcbx_dram_udqs_n = MCB_DDR3_dram_udqs_n
PORT mcbx_dram_udqs = MCB_DDR3_dram_udqs
PORT mcbx_dram_udm = MCB_DDR3_dram_udm
PORT mcbx_dram_ras_n = MCB_DDR3_dram_ras_n
PORT mcbx_dram_odt = MCB_DDR3_dram_odt
PORT mcbx_dram_ldm = MCB_DDR3_dram_ldm
PORT mcbx_dram_dqs_n = MCB_DDR3_dram_dqs_n
PORT mcbx_dram_dqs = MCB_DDR3_dram_dqs
PORT mcbx_dram_dq = MCB_DDR3_dram_dq
PORT mcbx_dram_ddr3_rst = MCB_DDR3_dram_ddr3_rst
PORT mcbx_dram_clk_n = MCB_DDR3_dram_clk_n
PORT mcbx_dram_clk = MCB_DDR3_dram_clk
PORT mcbx_dram_cke = MCB_DDR3_dram_cke
PORT mcbx_dram_cas_n = MCB_DDR3_dram_cas_n
PORT mcbx_dram_ba = MCB_DDR3_dram_ba
PORT mcbx_dram_addr = MCB_DDR3_dram_addr
PORT SYS_RST = proc_sys_reset_0_BUS_STRUCT_RESET
PORT PLL_LOCK = proc_sys_reset_0_Dcm_locked
END

BEGIN axi_gpio
PARAMETER INSTANCE = axi_gpio_0
PARAMETER HW_VER = 1.01.b
PARAMETER C_BASEADDR = 0x40000000
PARAMETER C_HIGHADDR = 0x4000ffff
PARAMETER C_GPIO_WIDTH = 4
BUS_INTERFACE S_AXI = axi4lite_0
PORT S_AXI_ACLK = clk_100_0000MHzPLL0
PORT GPIO_IO_O = axi_gpio_0_GPIO_IO_O
END

BEGIN axi_uartlite
PARAMETER INSTANCE = axi_uartlite_0
PARAMETER HW_VER = 1.02.a
PARAMETER C_BAUDRATE = 460800
PARAMETER C_USE_PARITY = 1
PARAMETER C_ODD_PARITY = 1
PARAMETER C_BASEADDR = 0x40600000
PARAMETER C_HIGHADDR = 0x4060ffff
BUS_INTERFACE S_AXI = axi4lite_0
PORT S_AXI_ACLK = clk_100_0000MHzPLL0
PORT RX = axi_uartlite_0_RX
PORT TX = axi_uartlite_0_TX
END



please, help me fix the bug?

Oleksandr Kiyenko

Hello Davidov,
Your code looks ok, except UCF. You generally don't need to cpecify DDR pins in UCF as EDK made it already and
you need to specify PLL location.
Best way for you to make this project it's start from our base project https://github.com/Trenz-Electronic/TE060X-GigaBee-Reference-Designs/tree/master/GigaBee_XPS14.2-Base
It contain both DDR3 memory controllers and memory test application.

Best regards
Alex

davidov