I use k10 to access sram. port size is 16bit. Data write and read is correct
BUT: interval time between two access is too Long. so the performace of flexbus is very low
WHY??
Acess SRAM 16 times takes 16us,See the attachment picture
Thanks...
Solved! Go to Solution.
Hi,
Please check the original code disassembly code.
You can set the compiler optimize level to enhance code execute speed.
Wish it helps.
Have a great day,
Mike
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi,
Could you please post the code about write data to external SRAM?
Have a great day,
Mike
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi,Hui_Ma:
Code is below:
#define SRAM_START_ADDRESS (*(volatile unsigned char*)(0x60000000))
unsigned short LoadWord(unsigned int offset)
{
return (*(volatile unsigned short*)(&SRAM_START_ADDRESS + offset));
}
void StoreWord(unsigned int offset,unsigned short data)
{
*(volatile unsigned short*)(&SRAM_START_ADDRESS + offset) = data;
}
void SramWriteBuffer(unsigned short *pBuf,unsigned int addr,unsigned int length)
{
int s,t;
if((addr % 2 >0) || (length % 2 >0))
{
return;
}
s=length/2;
for(t=0;t<s;t++)
{
StoreWord(addr+t*2, *(pBuf+t*2));
}
}
/////////////// TestSram : write sram 16 times
void TestSram(void)
{
unsigned short wbuf[16];
unsigned int t;
for(t=0;t<16;t++)
{
wbuf[t]=0x1234+t;
}
SramWriteBuffer(wbuf,0x0,16*2);
}
Thank you!
Hi,
Could you tried to use below code to do 16 times SRAM write (write to the same address 16 times)? How about the result?
void TestSram(void)
{
unsigned int t;
for(t=0;t<16;t++)
{
*(volatile unsigned short*)(&SRAM_START_ADDRESS ) = 0x1234;
}
}
Hi,Hui_Ma:
The timing writing to the same address 16 times looks normal,takes about 4us. Great Job!
What's the problew of origin code? Thank you!
Hi,
Please check the original code disassembly code.
You can set the compiler optimize level to enhance code execute speed.
Wish it helps.
Have a great day,
Mike
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------