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.

CC2650 Spi Slave

Other Parts Discussed in Thread: CC2650, SYSBIOS

Hi .

Currently I am using CC2650as spi slave for handling the ble activities., I can able to establish the communication between master and slave.,

After the Spi init I am sending data to slave and echo the data back to master ,

I configured CS as SDRY and another pin as a MRDY ,The problem is initially data received in slave but i am not receiving transmission call back,

But if I reset the master once the transmission is happening continuously.,What could be the reason.,

I am using ccs,

Spi intialized inside the simple peripheral task.,

And if enable the partial Enable it was not working

  • Hi,
    Can you use HostTest project as a reference? We have a SPI slave implemented in that project that comes with our latest SDK release. Specifically in the npi_tl_spi.c file.
  • Hi,

    I am trying to communicate between CC2650 and external MCU via SPI. I was using HostTest BLE project as reference. I created a custom task for SPI initialization w.r.t npi_tl_spi.c . The external MCU is configured as MASTER and CC2650 as slave. The MASTER keeps on pushing data and CC2650 receives some characters. But not fully. I can't figure out where I am messing the communication. I am adding a snippet of the code for the CC2650 section. I didn't incorporate BLE section in the project. It's just simple SPI communication between two micro controllers.
    #include <xdc/runtime/Error.h>
    #include <ti/sysbios/family/arm/cc26xx/Power.h>
    #include <ti/sysbios/BIOS.h>

    #include "ICall.h"
    #include "Board.h"
    #include "inc/npi_task.h"

    #include "HostTestApp.h"

    /* Header files required to enable instruction fetch cache */
    #include <inc/hw_memmap.h>
    #include <driverlib/vims.h>

    #ifndef USE_DEFAULT_USER_CFG

    #include "bleUserConfig.h"

    // BLE user defined configuration
    bleUserCfg_t user0Cfg = BLE_USER_CFG;

    #endif // USE_DEFAULT_USER_CFG

    /*******************************************************************************
    * CONSTANTS
    */

    /*******************************************************************************
    * MACROS
    */
    #include <ti/drivers/SPI.h> // header for SPI
    #include <ti/sysbios/knl/Task.h> // header for task struct
    #include <xdc/runtime/System.h> // header for system printf

    #define SPI_SLAVE_STACK_SIZE 1024
    #define SPI_SLAVE_TASK_PRIORITY 1

    // Task configuration
    Task_Struct spi_slave_Task;
    Char spi_slave_Task_stack[SPI_SLAVE_STACK_SIZE];
    #define SPI_SLAVE_BAUD_RATE 8000000
    SPI_Handle handle;
    SPI_Params params;
    SPI_Transaction spiTransaction;
    uint8_t receiveBufferPointer[50];
    uint8_t transmitBufferPointer[]={0};
    int ret=0;

    /**
    * Exception handler
    */
    void exceptionHandler()
    {
    while(1){}
    }
    void spi_tx_call(SPI_Handle handle, SPI_Transaction *objTransaction)
    {
    System_printf("\n RX");
    }
    void spi_slave_task_fxn(UArg a0, UArg a1)
    {
    SPI_Params_init(&params);
    // Slave mode
    params.mode = SPI_SLAVE;
    params.bitRate = SPI_SLAVE_BAUD_RATE;
    params.frameFormat = SPI_POL1_PHA1;
    // params.transferMode = SPI_MODE_CALLBACK;
    // params.transferCallbackFxn = spi_tx_call;

    handle=SPI_open(Board_SPI0,&params);
    if(!handle){
    System_printf("SPI did not open");
    }
    System_printf("\n SPI initialization done");

    spiTransaction.rxBuf= receiveBufferPointer;
    spiTransaction.txBuf = transmitBufferPointer;
    spiTransaction.count=64;

    while(1)
    {
    SPI_transfer(handle,&spiTransaction);
    }
    }
    /*
    * ======== main ========
    */
    int main()
    {
    PIN_init(BoardGpioInitTable);

    Task_Params taskParams;

    // Configure task
    Task_Params_init(&taskParams);
    taskParams.stack = spi_slave_Task_stack;
    taskParams.stackSize = SPI_SLAVE_STACK_SIZE;
    taskParams.priority = SPI_SLAVE_TASK_PRIORITY;

    Task_construct(&spi_slave_Task, spi_slave_task_fxn, &taskParams, NULL);

    /* enable interrupts and start SYS/BIOS */
    BIOS_start();

    return 0;
    }


    1) Is there something like BLE section should be incorporated (ICall_init() and others)?

    2) I had tried another configuration for CC2650 in which when I change the params.dataSize value, the number of data getting received changes, But then also it is jumbled. I am sending data like 0xFE,0xFF,0x00,0x01,0x02,.... till 0x1D. At CC2650, watch window, I can see 0xFE,0x02,0x08,0x0E...

    SPI_Params_init(&params);
    // params.transferMode=SPI_MODE_BLOCKING;
    // params.bitRate=1000000;//1000000
    params.mode=SPI_SLAVE;
    // params.frameFormat= SPI_POL1_PHA1;
    params.dataSize=48;
    handle=SPI_open(Board_SPI0,&params);
    if(!handle){
    System_printf("SPI did not open");
    }
    System_printf("\n SPI initialization done");

    spiTransaction.rxBuf= receiveBufferPointer;
    spiTransaction.txBuf = transmitBufferPointer;
    spiTransaction.count=32;

    I added 0xFE thinking if SOF is a must.