This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Memory bus error while initializing DDR3 on custom DM8168

Immediately after triggering the initialization of EMIF4[0], our board is going into some kind of fault state where JTAG no longer works. These are my relevant modifications to the v2 GEL file:

 

/*
 * DDR3 EMIF Paramters set for 796.5 MHz Clock Frequency
 */
#define EMIF_TIM1_DDR3_796              0x1779C9FE
#define EMIF_TIM2_DDR3_796              0x50608074
#define EMIF_TIM3_DDR3_796              0x009F857F
#define EMIF_SDREF_DDR3_796             0x10001841
//#define EMIF_SDCFG_DDR3_796             0x62A73832  /* 32 bit ddr3, CL=11, 8 banks, CWL=8 10 bit column, 2 CS, */
#define EMIF_SDCFG_DDR3_796 (\
0x03 << 29 | /* MEMTYPE */ \
0x01 << 27 | /* IBANKPOS (0-ignore rsize, 1-3h-use rsize)*/ \
0x02 << 24 | /* DDRTERM */ \
0x01 <<  5 | /* DDQS */ \
0x01 << 21 | /* DYNODT */ \
0x00 <<  0 | /* DLL */ \
0x01 << 18 | /* DRIVE */ \
0x03 << 16 | /* CWL */ \
0x00 << 14 | /* NM (1=16bit,0=32bit)*/ \
0x0E << 10 | /* CL */ \
0x06 <<  7 | /* RSIZE */ \
0x03 <<  4 | /* IBANK */ \
0x00 <<  3 | /* EBANK */ \
0x02 <<  0   /* PAGESIZE */ \
)

#define EMIF_PHYCFG_DDR3_796            0x00000110  /* local odt = 1, read latency = 11 (max = 12, min=6) */

 

EMIF4P_Init(unsigned int TIM1, unsigned int TIM2, unsigned int TIM3, unsigned int SDREF, unsigned int SDCFG, unsigned int RL){
     GEL_TextOut("\tSetup EMIF0 CFG ..... \n","Output",1,1,1);

  /*Program EMIF0 CFG Registers*/
  WR_MEM_32(EMIF4_0_SDRAM_TIM_1, TIM1);
  WR_MEM_32(EMIF4_0_SDRAM_TIM_1_SHADOW, TIM1);
  WR_MEM_32(EMIF4_0_SDRAM_TIM_2, TIM2);
  WR_MEM_32(EMIF4_0_SDRAM_TIM_2_SHADOW, TIM2);
  WR_MEM_32(EMIF4_0_SDRAM_TIM_3, TIM3);
  WR_MEM_32(EMIF4_0_SDRAM_TIM_3_SHADOW, TIM3);
  GEL_TextOut("\tSetting EMIF4_0_SDRAM_CONFIG to %x\n", "Output",1,1,1,SDCFG);
  WR_MEM_32(EMIF4_0_SDRAM_CONFIG, SDCFG);
  /* WR_MEM_32(EMIF4_0_SDRAM_REF_CTRL, SDREF); */
  /* WR_MEM_32(EMIF4_0_SDRAM_REF_CTRL_SHADOW, SDREF); */
  WR_MEM_32(EMIF4_0_DDR_PHY_CTRL_1, RL);
  WR_MEM_32(EMIF4_0_DDR_PHY_CTRL_1_SHADOW, RL);

  
  if(TWO_EMIF){
     GEL_TextOut("\tSetup EMIF1 CFG ..... \n","Output",1,1,1);
    /*Program EMIF1 CFG Registers*/
    WR_MEM_32(EMIF4_1_SDRAM_TIM_1, TIM1);
    WR_MEM_32(EMIF4_1_SDRAM_TIM_1_SHADOW, TIM1);
    WR_MEM_32(EMIF4_1_SDRAM_TIM_2, TIM2);
    WR_MEM_32(EMIF4_1_SDRAM_TIM_2_SHADOW, TIM2);
    WR_MEM_32(EMIF4_1_SDRAM_TIM_3, TIM3);
    WR_MEM_32(EMIF4_1_SDRAM_TIM_3_SHADOW, TIM3);
    WR_MEM_32(EMIF4_1_SDRAM_CONFIG, SDCFG);
    /* WR_MEM_32(EMIF4_1_SDRAM_REF_CTRL, SDREF); */
    /* WR_MEM_32(EMIF4_1_SDRAM_REF_CTRL_SHADOW, SDREF); */
    WR_MEM_32(EMIF4_1_DDR_PHY_CTRL_1, RL);
    WR_MEM_32(EMIF4_1_DDR_PHY_CTRL_1_SHADOW, RL);
  }

  if(DDR2) {
    /*  setup a small refresh period */
    WR_MEM_32(EMIF4_0_SDRAM_REF_CTRL, 0x0000613B);   /* initially a large refresh period */
    WR_MEM_32(EMIF4_0_SDRAM_REF_CTRL, 0x1000613B);   /* trigger initialization           */
    WR_MEM_32(EMIF4_0_SDRAM_REF_CTRL, (0x10000000|SDREF));   /* move to a smaller more correct one */

  if(TWO_EMIF){
    /*  setup a small refresh period */
    WR_MEM_32(EMIF4_1_SDRAM_REF_CTRL, 0x0000613B);   /* initially a large refresh period */
    WR_MEM_32(EMIF4_1_SDRAM_REF_CTRL, 0x1000613B);   /* trigger initialization           */
    WR_MEM_32(EMIF4_1_SDRAM_REF_CTRL, (0x10000000|SDREF));   /* move to a smaller more correct one */

    }
  }

	if(DDR3 && 1) {
		GEL_TextOut("\tInitializing EMIF0 ..... \n","Output",1,1,1);

		/*  setup a small refresh period */
		GEL_TextOut("\tSet large refresh period..... \n","Output",1,1,1);
		WR_MEM_32(EMIF4_0_SDRAM_REF_CTRL, 0x0000613B);   /* initially a large refresh period */
		if (RD_MEM_32(EMIF4_0_SDRAM_REF_CTRL) != 0x0000613B) {
			GEL_TextOut("\tWasn't able to set large refresh period..... \n","Output",1,1,1);
		}
		GEL_TextOut("\tTrigger initialization..... \n","Output",1,1,1);
		WR_MEM_32(EMIF4_0_SDRAM_REF_CTRL, 0x1000613B);   /* trigger initialization           */
		GEL_TextOut("\tChecking to see if it worked..... \n","Output",1,1,1);
		if (RD_MEM_32(EMIF4_0_SDRAM_REF_CTRL) != 0x1000613B) {
			GEL_TextOut("\tInit failed..... \n","Output",1,1,1);
		}
		GEL_TextOut("\tMove to smaller correct one..... \n","Output",1,1,1);
		WR_MEM_32(EMIF4_0_SDRAM_REF_CTRL, (0x10000000|SDREF));   /* move to a smaller more correct one */

		if(TWO_EMIF){
			GEL_TextOut("\tInitializing EMIF1 ..... \n","Output",1,1,1);
			/*  setup a small refresh period */
			WR_MEM_32(EMIF4_1_SDRAM_REF_CTRL, 0x0000613B);   /* initially a large refresh period */
			WR_MEM_32(EMIF4_1_SDRAM_REF_CTRL, 0x1000613B);   /* trigger initialization           */
			WR_MEM_32(EMIF4_1_SDRAM_REF_CTRL, (0x10000000|SDREF));   /* move to a smaller more correct one */
		}
	}
  if (SWLEVELINNG) {
    ddr3_sw_levelling(0);
    GEL_TextOut("DDR3 SWLEVELING DONE FOR EMIF0 \n","Output",1,1,1);
    ddr3_sw_levelling(1);
    GEL_TextOut("DDR3 SWLEVELING DONE FOR EMIF1 \n","Output",1,1,1);
  }
}

What does this error mean? Should I be adjusting the TIM[1:3] registers as well as CFG?

  • Hi Josh,

    I am facing similar kind of problem, with the same gel configuration, i have no issue with EMIF0 (If i disable #define TWO_EMIF 0), but as soon as i enabled that flag, my system also enters in fault state with the error message "CortexA8: Trouble Writing Memory Block at 0x4d00001c (0x4d000000+offset 0x1c to EMIF4_1_SDRAM_TIM_1_SHADOW register).

    Does anyone have any idea ??

    Kind regards,

    Hitesh

  • Hitesh:

    If you are able to boot your system with TWO_EMIF 0, but not with TWO_EMIF 1, then there may be something different about how you have the second EMIF interface connected. In my case I am unable to get even the first EMIF interface to start.

     

    Moderator:

    Why did you move my post to the Linux forum? I am using CCS 5.1 under Windows, and at this point am doing nothing but trying to initialize a custom DM8168 design with a JTAG programmer. Linux has nothing to do with my setup.

     

    All:

    I see I forgot to include the actual text of the error I get in CCS. The error was "trouble reading memory block" and the address it showed was from the line where I attempt to read back the value of EMIF4_0_SDRAM_REF_CTRL after setting the initialize bit.

  • Well Josh,

    While looking in detail, i also came to know that, my code hangs at a point similar to you in GEL file but with EMIF1. I mean to say, it hangs while i am writing to EMIF4_1_SDRAM_REF_CTRL register once i set trigger initialization. The same code is working with EMIF0.

    Code is as below:

    if(ENABLE_DDR0)
    {
        /* Setup a small refresh    period */
        WR_MEM_32(EMIF4_0_SDRAM_REF_CTRL,    0x0000613B);                    //    Initially a    large    refresh period   
        WR_MEM_32(EMIF4_0_SDRAM_REF_CTRL,    0x1000613B);                    //    Trigger initialization
        WR_MEM_32(EMIF4_0_SDRAM_REF_CTRL,    (0x10000000|SDREF));            //    Move to a smaller    more correct one         
    }

    Can anyone knows why this is happening ??

     

    Regards,

    Hitesh

  • Hi Josh,

    Can you please give us more details about following ?

    - Which DDR chip you are using ? Is it 8bit/16 bit ? What is size configuration ?

    - Which processor chip you are using ? Please give us exact chip number.

    Thanks,
    Sweta

  • Hi All,

    i have the same problem with my application based on TMS320DM8168BCYG. I use CCS v5.2 with GEL file for DM8168 with some small mods for my board. There are used both EMIF each populated by 2x DDR3-1600, 16bit width, 4Gb density. Every time I'm trying to set bit ASR=1 in SDRRCR the EMIF  freezes and no longer answer to any request (I cant acces any EMIF i/f nor DDR base address). In case I don't set ASR=1 then everithing is runing normaly until DDR forget data (no refresh).

    This not depend on: refresh rate, configuration in SDRCR, system how I set SDRRCR register

    There is the error i usualy got:

    CortexA8: Trouble Writing Memory Block at 0x4c000014 on Page 0 of Length 0x4: (Error -2130 @ 0x4C000014) Unable to access device memory. Verify that the memory address is in valid memory. If error persists, confirm configuration, power-cycle board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 5.0.747.0) 

    CortexA8: GEL: Error while executing OnTargetConnect(): target access failed at *((unsigned int *) (0x4C000000+0x14))=(unsigned int) SDREF [rabbitlake.gel:328]

    WR_MEM_32(EMIF4_0_SDRAM_REF_CTRL, SDREF);                                 // This is always last instruction passed to EMIF 
    WR_MEM_32(EMIF4_0_SDRAM_REF_CTRL_SHADOW, SDREF);            // Here EMIF stop talking with me ... from this point every instruction accesing EMIF or DDR fails
    WR_MEM_32(EMIF4_0_DDR_PHY_CTRL_1, RL);

    Any idea?

    Thanks a lot

  • Hi,

    I have the same problem too.  I have the exact same devices as on the EVM, the layout is copied, but the u-boot code works on the EVM and not on my board.  As soon as I write to the SDRAM_REF_CTRL register the cpu seems to stop - it doesn't run a single extra instruction.  If anyone has managed to solve this, or knows how to work around it I would be very grateful.  The only thing I've managed to determine is that the EVM has rev 1 silicon and my board has rev 3 silicon (DEVICE_ID register).

    Cheers,

    Simon

  • I have the same problem on my custom DM816x-based board too!

    Also, I have DM816XEVM board, but I doesn't boot when I turn off EMIF0 or EMIF1 (I just comment #define USE_EMIF0/USE_EMIF1).

    Any suggestions?...

  • As I recall, there are multiple places during boot up that it tries to initialise the ddr memory, or bits of it.  Not all are turned off with a single #define.  Also, something like the tiler, where it tries to apportion blocks of the memory between the two banks needs reconfiguring.  There are forum posts about this, but I don't recall them now.

    My board failed because some of the DDR termination resistors weren't soldered properly!  But works ok now, but then I'm using both banks - not tried to turn one off.

  • Thanks for reply, Simon!

    What termination resistors do you mean? Parallel or sequence? Could you please list equivalent ones from DM816x evm board?

    Thanks!

  • Hi all.

    Has this discusson given some light ?

    Have the like of issue when changing MT41J128M16HA-15E:D -> MT41K128M16JT-125:K .


    Now the GEL file delivered on processors.wiki.ti.com/.../DM816x_C6A816x_AM389x_DDR3_Init crashed just after
    text "Initializing EMIF1" with similar errors.

    Thos Micron devices mentioned to be compatible.

    -niilo