Continuous access time interval of K10 FlexBus is too long,WHY?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Continuous access time interval of K10 FlexBus is too long,WHY?

Jump to solution
860 Views
yangzeyong
Contributor III

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...

1 Solution
705 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

5 Replies
705 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
705 Views
yangzeyong
Contributor III

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!

0 Kudos
705 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

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;

    }

}

0 Kudos
705 Views
yangzeyong
Contributor III

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!

p4.PNG

0 Kudos
706 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------