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.

RM48L952 access SDRAM (IS42S16400F) failed occationally on RM48HDK

hi, 

i need to run code in sdram and use it as a buffer. the question is after i configure the EMIF for sdram and call emif_SDRAMInit(), the sdram access failed occationanlly.

the test code is as following: see my comments in red color

can someone tell me why this happen?

memset(buf1,0,sizeof(buf1)); // the buf1 and buf2 is assigned in SDRAM by linker script
memset(buf2,0,sizeof(buf2));
for (a=0;a<sizeof(buf1);a++)
{
buf1[a] = a; // the write into buf1 failed at some location e.g. buf1[3], but if i add the following state it works. and if i debug step by step it also works.
//buf1[a] = a;
//*(int*)0x80050000 = buf1[a]; 
}
memcpy(buf2,buf1,sizeof(buf2));
for (a=0;a<sizeof(buf2);a++)
{
if(buf2[a] != a)
{
printf("sdram error1 @ %d = %d\r\n", a, buf2[a]);
//while(1);
}
}

  • Hi,

      If you try the below SDRAM config will you still get the same problem? Can you please tell me what memory attribute (NORMAL, DEVICE or Strongly-Order) you have for the SDRAM region? Can you change to Strongly-Order and see if it makes a difference?

      

  •  i tried your configuration, the problem is still the same.

    i also check my MPU setting, MPU is disabled and for SDRAM it is Strongly-Ordered_Shareable. see figure

    and i find a interesting thing if i replace memset/memcpy by for loop it works well. see figure.

    why i cannot use memset? (i use IAR 7.10, this function is supplied by compiler )

  • Hi Eric,

     Can you please check the silicon version for the RM48 device on the HDK board. If it is of revC or earlier then the below errata applies to the silicon. Basically the compiler is creating STM instructions when you use memset/memcpy. Please avoid using STM instructions but rather only STR when writing to the EMIF. Please also take a look at this post that provides further information. 

  • Hi Charles,
    thanks for your answer, it helps me a lot.
    can you confirm if I purchase a silicon revD or later, the bug is fixed?
    the workaround said a compiler patch is available, mean -no_stm? (I see it from other post question), but it is specific for CCS, any suggestion for IAR compiler?
    what about STACK? can I use the SDRAM as a STACK region?
    last question is I also test DMA transfer from SDRAM to SDRAM it also fails just like memcpy, does DMA works on the SDRAM? (I saw it can work on the SDRAM in the post you mentioned)

    BR Eric
  • Hi Eric,

    Yes, silicon revision D has the errata fixed. I don't think there is solution from IAR but please check with IAR support to see if they have a way to prevent certain instructions from being compiled.

    I will suggest you use internal RAM for stack. Stack pushing is normally done in STM.

    How did you configure the DMA. If you configure the DMA source and destination element size with 64-bit then the DMA is designed to burst. DMA bursting behavior is similar to a CPU STM operation where the data is written back-2-back.
  • Hi Charles,

    Thank you for your help.