This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCPDT: TIVA SPI_transfer() max frames

Part Number: TM4C1294NCPDT

Tool/software:

I am using 

ccs 8.3.0.201810301800
TIRTOS 2.16.1.14,
compiler 5.2.7
XDC 3.31.1333
TM4C1294NCPDT
ndk_2_25_00_09

I am interfacing a large flash memory to the TIVA via the SPI interface.  I seem to have found a limit where I can not do a continuous SPI transfer of more than 1024 transfers.

I put the following code together to see what the limit of the transfer count is and the code runs and the transfer works up to 1024 bytes then fails at 1025.

// starting at 1, do a transfer and if successful add one to the transfer till the transfer fails. 

for(rc=1; rc<0xffff; rc++) // this fails at 1025 and passes at 1024
{
    masterTransaction.count = rc;

    transferOK = SPI_transfer(masterSpi3, &masterTransaction); // TI RTOS Users guide p67/122
    if(transferOK == 0)
    {
         printf("SPI_transfer() %d %d\r", rc, transferOK);

         break;

      }
}

Is there a way to get this to do a continuous transfer of about 5,000 transfers?

  • Hi Doug,

      Tracing the driver code in C:\ti\tirtos_tivac_2_16_00_08\products\tidrivers_tivac_2_16_00_08\packages\ti\drivers\spi\SPITivaDMA.c, it is checking if the transfer count is larger than 1024. See below. I don't see a way around this unless you modify the driver and rebuild TI-RTOS or at your application level, issue another SPI_transfer() when you go over 1024. 

    /*
    * ======== SPITivaDMA_transfer ========
    * @pre Function assumes that handle and transaction is not NULL
    */
    bool SPITivaDMA_transfer(SPI_Handle handle, SPI_Transaction *transaction)
    {
    unsigned int key;
    SPITivaDMA_Object *object = handle->object;
    SPITivaDMA_HWAttrs const *hwattrs = handle->hwAttrs;

    /* Check the transaction arguments */
    if ((transaction->count == 0) || (transaction->count > 1024) ||
    !(transaction->rxBuf || transaction->txBuf) ||
    (!(transaction->rxBuf && transaction->txBuf) && !hwattrs->scratchBufPtr)) {
    return (false);
    }