AnsweredAssumed Answered

Who has  Blocking  Transfer LPSPI demo?

Question asked by zhihui liu on Jan 23, 2019
Latest reply on Jan 26, 2019 by zhihui liu

Who has  Blocking  Transfer LPSPI demo? now, i use LPSPI  to read and write data from w25q64 (as dataflash),read data is fast,but written data is incorrect ,cannot be written successfully,how can i use LPSPI_MasterTransferBlocking() to complete write task successfully?

following is read function,is OK :

 

void  W25QXX_Read_Boost(u8* pBuffer,u32 ReadAddr,u32 NumByteToRead)

{

lpspi_transfer_t spi_tranxfer;

 spi_tranxfer.configFlags = kLPSPI_MasterPcs1|kLPSPI_MasterPcsContinuous;

spi_tranxfer.txData   = spitxdata;                 //要发送的数据

spi_tranxfer.rxData   = pBuffer;                 //接收到的数据

spi_tranxfer.dataSize = NumByteToRead;                        //数据长度

 LPSPI_MasterTransferBlocking(LPSPI3,&spi_tranxfer);     //SPI阻塞发送

W25QXX_CS(SET);

}

following is write function (cannot be written successfully) :

void W25QXX_Write_Page(const u8* pBuffer,u32 WriteAddr,u16 NumByteToWrite)

{

lpspi_transfer_t spi_tranxfer;

W25QXX_Write_Enable();    

LPSPI3_ReadWriteByte((u8)WriteAddr);

..

..

spi_tranxfer.configFlags = kLPSPI_MasterPcs1|kLPSPI_MasterPcsContinuous;

spi_tranxfer.txData   = pBuffer;

 spi_tranxfer.rxData   = spirxdata;  

spi_tranxfer.dataSize = NumByteToWrite;

LPSPI_MasterTransferBlocking(LPSPI3,&spi_tranxfer);

W25QXX_CS(SET);

W25QXX_Wait_Busy();

}

Anyone with similar experience, or driver code, please give me some guidance. Thank you.

Outcomes