Access time of K10 SPI is too long,WHY?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Access time of K10 SPI is too long,WHY?

1,359件の閲覧回数
yangzeyong
Contributor III

I use k10 to access SPI Flash(SST26VF064B). Data write and read is correct

BUT: interval time between multi-Byte transfer is too Long, so the performace of spi is very low

WHY??

SPI-CLK is  24.576Mhz, one byte transfering takes 300ns. but interval time between multi-Byte transfer is 2us.

p0.PNG

I use PE, enable spi interrupt to control transfering,  

p2.PNG

The code is blow:

unsigned int SST26_ReadID(void) // send cmd to get flash ID
{
       unsigned char cmd[4]; //1-Byte cmd and  3-Byte dummy characters
       unsigned char data[4];

       memset(cmd,0x0,4); 

       cmd[0]=0x9F; //JEDEC-ID Read Command
       SPI_ReceiveBlock(SPI_Ptr,data,4);

       SPI_SendBlock(SPI_Ptr,cmd,4);

      while(1)
      {
           if(flag_OnBlockReceived==TRUE)
          {
              flag_OnBlockReceived=FALSE;
             break;
          }
     }
     return ((data[1]<<16)|(data[2]<<8)|(data[3]));
}

/*
** ===================================================================
** Event : SPI_OnBlockReceived (module Events)
**
** Component : SPI [SPIMaster_LDD]
*/
/*!
** @brief
** This event is called when the requested number of data is
** moved to the input buffer. This method is available only if
** the ReceiveBlock method is enabled.
** @param
** UserDataPtr - Pointer to the user or
** RTOS specific data. The pointer is passed
** as the parameter of Init method.
*/
/* ===================================================================*/
void SPI_OnBlockReceived(LDD_TUserData *UserDataPtr)
{
     /* Write your code here ... */
     flag_OnBlockReceived=TRUE;
}

Thanks...

ラベル(1)
0 件の賞賛
返信
5 返答(返信)

1,186件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi zeyong yang,

   From your SPI bus wave, I think it's related to your API code or your SPI calling code.

   If you don't want there has too long time between each byte in the SPI bus, I suggest you use the interrupt method, and send multiple bytes together instead of send one byte by one byte.

   Please modify your code to interrupt mode, and try it again.

   If you still have question about it, please let me know!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

1,186件の閲覧回数
yangzeyong
Contributor III

Hi,Kerry Zhou,

        I think i have use the interrupt method .  

        The sending API sends multiple bytes togerther In ONE valid CS#. I do not know the  interrupt mode you said.

        Probably API inner code  cause long interval between bytes

        thank you!

0 件の賞賛
返信

1,186件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi zeyong,

   PE code is a little redundancy, it's not simple.

  Please open  SPI_SendBlock, and SPI_ReceiveBlock, post the code, you will find may still call other functions.

  Please tell me what the PE SPI component you are using, and also tell me what the K10 chip you are using now?

  If you want to minimize the delay time between each byte, I suggest you don't use the API function, you can use the register to control it, then use the interrupt, it will send the byte by byte very quickly.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

1,186件の閲覧回数
yangzeyong
Contributor III

Hi,Kerry Zhou,

     

       The API SPI_SendBlock and SPI_ReceiveBlock  code are below:

p0.PNG

-----

I use SPIMaster_LDD component  and MK10DN512VLL10

p1.PNG

I like to use PE, this tool is convenient.

Thank you!

0 件の賞賛
返信

1,186件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Zeyong,

    If you very care about the time gap between SPI bytes, I suggest you don't use the PE code, you can use the baremental code, then use the interrupt to control the SPI sending, actually, even you use the polling mode, the time gap between SPI bytes also will be minimized.

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信