cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
2,014 Views
Registered: ‎06-29-2009

a SW problem when accessing th RAM

Jump to solution

Hi,

I have a problem when I try to write some data to my DDR3 RAM.  I can write a value on a specific address (eg RAM[10] = 0x23), but when I write a entire region, it freeze after a while (eg RAM[counter] = 0x23).

I tried to change the heap and stack, but didn't help.I changed the max value of "teller2" into something realy low, to test if I don't get out of bound ....  but it always hangs at the end (I supose when it gets out of the FOR loop).

I also tried different manners to write with pointers or array.

 

I did write a small piece of code to test the write to the RAM ... and it acted also strange for higher values (see code at the bottom)

 

Is there a typical error that I make in my code ,  or how could I trace the error or the reason.

(I never used the debig function,  ... could this help and is it easy to use ... it looks like you need a localhost ... ?)

 

Thx!

 

The actual code is nested in successive "IF" statements and looks like:

 

u8 * memRamNIP = BASEADDR_DDR3;

 u8* mem = &memRamNIP;
    for (teller2 = 0; teller2 < dataLengthParse; teller2++ )
    {
       xil_printf("%c", EBuf[GetDataPointer() + teller2]);
       memRamNIP[teller2]=5;  //This is not ok Freezes when reached teller2 = dataLengthParse

     // memRamNIP[100]=5;    This is OK
                          
           }

 


The Code for testing:

 

It works for X max = 2000 ... , but when I use 10.000 ... it only puts END on the screen

 

while(1)

{

 

 xil_printf("START ...");
       u32 x;
       for(x=0 ; x < 10000;x++)
       {
          memRam[x] = 5;
       }    
        xil_printf("END ...");

 

}

0 Kudos
1 Solution

Accepted Solutions
Highlighted
2,572 Views
Registered: ‎06-29-2009

OK,

 

The problem was a wrong adressing. 

 

u8 * memRamNIP = BASEADDR_DDR3;  That address pointed not to the DDR3 RAM, but to the CTRL_DDR3 wich is sowhere 0XFFFFFF instead of 0x5000...

 

Hence when writing to that adress and the next folowwing  bytes (which is 0x0000) ... I wrote in the BRAM (where the SW resides)  and made the program crash.

View solution in original post

0 Kudos
1 Reply
Highlighted
2,573 Views
Registered: ‎06-29-2009

OK,

 

The problem was a wrong adressing. 

 

u8 * memRamNIP = BASEADDR_DDR3;  That address pointed not to the DDR3 RAM, but to the CTRL_DDR3 wich is sowhere 0XFFFFFF instead of 0x5000...

 

Hence when writing to that adress and the next folowwing  bytes (which is 0x0000) ... I wrote in the BRAM (where the SW resides)  and made the program crash.

View solution in original post

0 Kudos