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);
}
}