Hi all,
Souce :
PDK_INSTALL_PATH\ti\drv\spi\test\qspi_flash\src\Flash_S25FL\S25FL.c
We usually think that dummy reads are inserted before "data read",
In this program, dummy reads are inserted before "Write Address".
Is this a mistake in the program?
/* Write read command */
writeVal[0] = readCmd;
transaction.txBuf = (unsigned char *)&writeVal[0];
transaction.rxBuf = NULL;
transaction.count = 1;
transferType = SPI_TRANSACTION_TYPE_WRITE;
SPI_control(handle, SPI_V1_CMD_TRANSFERMODE_RW, (void *)&transferType);
retVal = SPI_transfer(handle, &transaction);
/* Write dummy bits for fast read if required */
if(0 != numDummyBits)
{
writeVal[0] = 0U;
transaction.txBuf = (unsigned char *)&writeVal[0];
transaction.rxBuf = NULL;
transaction.count = (numDummyBits >> 3); /* In bytes */
transferType = SPI_TRANSACTION_TYPE_WRITE;
SPI_control(handle, SPI_V1_CMD_TRANSFERMODE_RW, (void *)&transferType);
retVal = SPI_transfer(handle, &transaction);
}
/* Write Address Bytes */
/* *tempPtr = (unsigned int)srcAddr; */
/* transaction.txBuf = (unsigned char *)tempPtr; */
transaction.txBuf = (unsigned char *)srcAddr;
transaction.rxBuf = NULL;
transaction.count = addrLengthInBytes;
transferType = SPI_TRANSACTION_TYPE_WRITE;
SPI_control(handle, SPI_V1_CMD_TRANSFERMODE_RW, (void *)&transferType);
retVal = SPI_transfer(handle, &transaction);
/* Read the actual flash data */
transaction.txBuf = NULL;
transaction.rxBuf = (unsigned char *)dstOffstAddr;
transaction.count = length;
Best regards,
sasaki