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.

CC3220SF-LAUNCHXL: SPI transfer failing despite working in an earlier function

Part Number: CC3220SF-LAUNCHXL


Hello,

I am having an issue when running multiple SPI transfers consecutively where the first SPI transfer starts successfully but when I run the next transfer, it is unsuccessful. My SPI module is running in callback mode and the function giving issues is shown below:

SPI_Transaction transaction;
    int i;

    for (i = 0; i < 5; i++)
    {
        rxBuffer1[i] = 0x00;
        txBuffer1[i] = 0x00;

        rxBuffer2[i] = 0x00;
        txBuffer2[i] = 0x00;

        rxBuffer3[i] = 0x00;
        txBuffer3[i] = 0x00;
    }


//////////////////  GET ENCODER 1 COUNT   ////////
    txBuffer1[0] = REQUEST_COUNT;

    transaction.count = 5;
    transaction.txBuf = (void *) txBuffer1;
    transaction.rxBuf = (void *) rxBuffer1;
    transaction.arg = (void *) 'a';

    GPIO_write(ENCODER_S1, 0);
    bool transferOK = SPI_transfer(encoderSPI, &transaction);

    if (transferOK)
    {
        GPIO_write(ENCODER_S1, 1);
    }

///////////////////////     GET ENCODER 2 COUNT//////////////////////
    txBuffer2[0] = REQUEST_COUNT;

    transaction.count = 5;
    transaction.txBuf = (void *) txBuffer2;
    transaction.rxBuf = (void *) rxBuffer2;
    transaction.arg = (void *) 'b';

    GPIO_write(ENCODER_S2, 0);
    transferOK = SPI_transfer(encoderSPI, &transaction);

    if (transferOK)
    {
        GPIO_write(ENCODER_S2, 1);
    }

///////////////////////     GET ENCODER 3 COUNT//////////////////////
    txBuffer3[0] = REQUEST_COUNT;

    transaction.count = 5;
    transaction.txBuf = (void *) txBuffer3;
    transaction.rxBuf = (void *) rxBuffer3;
    transaction.arg = (void *) 'c';

    GPIO_write(ENCODER_S3, 0);
    transferOK = SPI_transfer(encoderSPI, &transaction);

    if (transferOK)
    {
        GPIO_write(ENCODER_S3, 1);
    }

Any help would be greatly appreciated, let me know if there is any more information you need!