Part Number: CC2640R2F
Tool/software:
Hi Community,
I am using SPI0 for my external flash memory in my custom design. It was working perfectly when I use SPI_MODE_BLOCKING as transfer mode. Recently I had to use it in non blocking mode and I changed the transfermode to be SPI_MODE_CALLBACK.
My call back is getting invoked for each transfer and I am seeing that the transaction status is becoming SPI_TRANSFER_COMPLETED. transfer count also matching perfectly. But I am not able to see any receive data inside my rx buffer.
Below are my initialization & read flash ID routines for your reference:
int smartMCT_SPI0Init(void) // SPI0 init
{
//SPI0 init
SPI_Params_init(&SbpSpiParams);
SbpSpiParams.bitRate = 8000000;
SbpSpiParams.transferMode =SPI_MODE_CALLBACK;
SbpSpiParams.frameFormat = SPI_POL0_PHA0;
SbpSpiParams.dataSize = 8;
SbpSpiParams.transferCallbackFxn = wdt_spi_cb;
SbpSpiHandle = SPI_open(MY_SPI0, &SbpSpiParams);
if(SbpSpiHandle == NULL)
{
return -1;
}
}
// Reading flash ID
uint8 MH_SPIReadID(uint8 addr,uint8 *out)
{
txbuf[0] = 0x9F; // read command
txbuf[1] = 0xFF;
txbuf[2] = 0xFF;
txbuf[3] = 0xFF;
txbuf[4] = 0xFF;
txbuf[5] = 0xFF;
txbuf[6] = 0xFF;
txbuf[7] = 0xFF;
spiTransaction.arg = NULL;
spiTransaction.count = 8;
spiTransaction.txBuf = txbuf;
spiTransaction.rxBuf = out;
PIN_setOutputValue(myPins, MH_CS, 0); // /CS enable
SPI_transfer(SbpSpiHandle, &spiTransaction);
PIN_setOutputValue(myPins, MH_CS, 1); // /CS disable
return 0;
}
What could I be doing wrong? Any considerations for receive data in callback mode?
Best
Lakshmi