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.

RTOS/SW-EK-TM4C129EXL: Issues with SPI

Part Number: SW-EK-TM4C129EXL

Tool/software: TI-RTOS

           I need to send data for every 0.5 ms through SPI protocol. I had configured timer stattically for 0.5 milliseconds and added the code for sending data via SPI, in ISR of the Timer configured, still it's not working. This is the code

/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <xdc/cfg/global.h>

/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>

/* TI-RTOS Header files */
#include <ti/drivers/GPIO.h>
#include <ti/drivers/SPI.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/family/arm/m3/Hwi.h>

/* Board Header file */
#include "Board.h"
#include "driverlib/gpio.h"
#include <inc/hw_memmap.h>
#include <inc/hw_types.h>
#include <inc/hw_ssi.h>
#include <driverlib/ssi.h>
#include <driverlib/udma.h>
#include <driverlib/sysctl.h>
#include "driverlib/timer.h"
#include <ti/sysbios/hal/Timer.h>

UChar array[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
UChar receiveBuffer[8];
UChar transmitBuffer[8];

void spiDataSend()
{
    int l;
    for (l = 0; l < 8; l++)
    {
     transmitBuffer[l] = array[l];
    }
    int i;
    SPI_Handle spi;
    SPI_Params spiParams;
    SPI_Params_init(&spiParams);
    spiParams.dataSize = 8; /* dataSize can range from 4 to 8 bits */
    spiParams.transferMode = SPI_MODE_BLOCKING;
    spiParams.mode = SPI_MASTER;
    spiParams.transferCallbackFxn = NULL;
    spi = SPI_open(Board_SPI0, &spiParams);
    if (spi == NULL) {
    /* Error opening SPI */
    }
    SPI_Transaction spiTransaction;
    Bool transferOK;
    spiTransaction.count = 8;
    spiTransaction.txBuf =  transmitBuffer;
    spiTransaction.rxBuf =  receiveBuffer;
    transferOK = SPI_transfer(spi, &spiTransaction);

    if (transferOK) {
    /* Error in SPI transfer or transfer is already in progress */

    System_printf("SPI Transfer is successful \n");
    System_flush();
    }
    System_printf("transmitBuffer is : \n");
    System_flush();
    for (i = 0; i < 8; i++)
    {
     System_printf(" %x ",transmitBuffer[i]);
    }
    System_printf("\n");
    System_flush();
    SPI_close(spi);
}
void hw_init()
{
    Board_initGeneral();
    Board_initGPIO();
    Board_initSPI();
}
/*
 *  ======== main ========
 */
int main(void)
{  

    hw_init();

   /* Start BIOS */
    BIOS_start();
    return (0);
}