Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

CCS/CC2650: SPI_Transfer did not go through

$
0
0

Part Number:CC2650

Tool/software: Code Composer Studio

Hi, 

I am stuck in the spi transfer function and i am not sure what I did wrong. Could someone help me out here. I am really appreciate it. Here is my code. I set the chip select low to enable the data transfer and set it back high after the transfer. But the problem is the SPI Transfer() never goes through. 

thank you so much. 

 *  ======== empty.c ========

 */

/* XDCtools Header files */

#include <xdc/std.h>

#include <xdc/runtime/System.h>

#include "ADXL362.h"

#include <ti/drivers/SPI.h>

#include <ti/drivers/spi/SPICC26XXDMA.h>

#include <ti/drivers/dma/UDMACC26XX.h>

/* BIOS Header files */

#include <ti/sysbios/BIOS.h>

#include <ti/sysbios/knl/Clock.h>

#include <ti/sysbios/knl/Task.h>

/* TI-RTOS Header files */

// #include <ti/drivers/I2C.h>

#include <ti/drivers/PIN.h>

// #include <ti/drivers/SPI.h>

// #include <ti/drivers/UART.h>

// #include <ti/drivers/Watchdog.h>

/* Board Header files */

#include "Board.h"

#define TASKSTACKSIZE   1024

/* SPI Board */

//#define Board_SPI0_MISO                     IOID_8

//#define Board_SPI0_MOSI                     IOID_9

//#define Board_SPI0_CLK                      IOID_10

//#define Board_SPI0_CS                       IOID_13

Task_Struct task0Struct;

Char task0Stack[TASKSTACKSIZE];

/* Pin driver handle */

static PIN_Handle ledPinHandle;

static PIN_State ledPinState;

/*

 * Application LED pin configuration table:

 *   - All LEDs board LEDs are off.

 */

PIN_Config ledPinTable[] = {

    IOID_13 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX,

    PIN_TERMINATE

};

/*

 *  ======== heartBeatFxn ========

 *  Toggle the Board_LED0. The Task_sleep is determined by arg0 which

 *  is configured for the heartBeat Task instance.

 */

Void heartBeatFxn(UArg arg0, UArg arg1)

{

        SPI_Handle      spi;

        SPI_Params      spiParams;

//    SPI_close(spi);

        SPI_Transaction spiTransaction;

        uint8_t         transmitBuffer[1];

        uint8_t         receiveBuffer[3];

        bool            transferOK;

        SPI_Params_init(&spiParams);

        spi = SPI_open(Board_SPI1, &spiParams);

        while(1) {

            PIN_setOutputValue(ledPinHandle, IOID_13, 0);

            transmitBuffer[0] = 0x0B;

            spiTransaction.count = 1;

            spiTransaction.txBuf = transmitBuffer;

            //spiTransaction.rxBuf = receiveBuffer;

            SPI_transfer(spi, &spiTransaction);

            PIN_setOutputValue(ledPinHandle, IOID_13, 1);

        }

        SPI_close(spi);

}

/*

 *  ======== main ========

 */

int main(void)

{

    //Board_initGeneral();

    Task_Params taskParams;

    /* Call board init functions */

    Board_initGeneral();

     //Board_initI2C();

     Board_initSPI();

    /* Construct heartBeat Task  thread */

    Task_Params_init(&taskParams);

    taskParams.arg0 = 1000000 / Clock_tickPeriod;

    taskParams.stackSize = TASKSTACKSIZE;

    taskParams.stack = &task0Stack;

    Task_construct(&task0Struct, (Task_FuncPtr)heartBeatFxn, &taskParams, NULL);

    System_printf("Starting the example\nSystem provider is set to SysMin. "

                  "Halt the target to view any SysMin contents in ROV.\n");

    /* SysMin will only print to the console when you call flush or exit */

    System_flush();

    /* Start BIOS */

    BIOS_start();

    return (0);

}


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>