problem in writing and reading from DDR3 in zed board

OP (Company: sssihl) #4919409
Rate this post
• ▲ useful
▼ not useful
HI ,

I have written following code for writing and reading from DDR3 of zynq. 
It is not displaying any outputs. What's wrong with this:
1
#include <stdio.h>
2
#include "platform.h"
3
#include "xil_printf.h"
4
#include "xil_io.h"
5
#include "xparameters.h"
6

7
#define DDR_BASEADDR 0x01000000
8
//#define IN_BASEADDR DDR_BASEADDR + 0x1000000
9
//#define TR_BASEADDR    DDR_BASEADDR + 0x2000000
10
//#define BIN_BASEADDR   DDR_BASEADDR + 0x3000000
11

12
int main()
13
{
14
   init_platform();
15
    int i,j;
16
    int val;
17
    int img[5]={1,2,3,4,5};
18
    for (i = 0; i <5; i++) {
19
      Xil_Out32(DDR_BASEADDR+(i), img[i]);
20
    }
21
    for (j = 0; j <5; j++) {
22
      val = Xil_In32(DDR_BASEADDR+(j));
23
      printf("val %d",val);
24
        }
25
    cleanup_platform();
26
    return 0;
27
}
Moderator (Company: Titel) #4919416
Rate this post
• ▲ useful
▼ not useful
Sai S. wrote:
> It is not displaying any outputs.
Maybe your monitor is broken?

> It is not displaying any outputs.
What happens instead?
Where do you get "no output"?
What do you expect to happen where?
What do you get instead?
Does a simple printf("Hello world!") show any output?

BTW:
Pls wrap your C code with the [c] tokens, as described in "Formatting 
options" a few lines above every text input box here.
Moderator (Company: Titel) #4919426
Rate this post
• ▲ useful
▼ not useful
Sai S. wrote:
> But it compiles without any error
Debug with single step or add some printf() to find out where your 
software stucks:
1
int main()
2
{
3
   init_platform();
4
   printf("init done");
5
    int i,j;
6
    int val;
7
    int img[5]={1,2,3,4,5};
8
    for (i = 0; i <5; i++) {
9
      Xil_Out32(DDR_BASEADDR+(i), img[i]);
10
    }
11
    printf("memory written");
12
    for (j = 0; j <5; j++) {
13
      val = Xil_In32(DDR_BASEADDR+(j));
14
      printf("val %d",val);
15
    }
16
    printf("memory read");
17
    cleanup_platform();
18
    return 0;
19
}

BTW: where do you have the 0x01000000 from?

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.