Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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.

LAUNCHXL-CC2650: SPI MISO delay and repeat under slave mode

Part Number: LAUNCHXL-CC2650
Other Parts Discussed in Thread: CC2650,

Hi all,

I have some problem with CC2650 SPI slave mode. 

I try to send a 16 bits MISO  (SPI clk = 4M, and 16 bits each CS)

It can work well. (the figure below is what I want)

However, the MISO have some unexpected error.

Sometimes, It transmits with a several bis delay or repeat part of the pattern I asked to send. (show in the figure below)

I guess the problem is  SPI PIN assignment or the way i used SPI_transfer.

My code is base on example simple_peripheral.

The code below is how I initial and call SPI.

    SPI_init();

    // init SPI
    SPI_Params spi_ask_params;
    SPI_Params_init(&spi_ask_params);
    spi_ask_params.dataSize            = 8;
    spi_ask_params.frameFormat         = SPI_POL0_PHA1;
    spi_ask_params.bitRate             = UMC_ASK_FREQ;  // 4 Mhz
    spi_ask_params.mode                = SPI_SLAVE;
    spi_ask_params.transferMode        = SPI_MODE_CALLBACK;  // when call back mode we can understand this mission is done or not
    spi_ask_params.transferCallbackFxn = spi_ask_callback;

    spi_ask_handle = SPI_open(Board_SPI0, &spi_ask_params);

    spi_ask_transaction.count = SPI_BUFFER_SIZE;  // 20
    spi_ask_transaction.txBuf = spi_txbuf;
    spi_ask_transaction.rxBuf = spi_rxbuf;


spi_done = SPI_transfer(spi_ask_handle, &spi_ask_transaction);

The only thing SPI callback function do is reset all the txbuf. 

The code below is my PIN assignment.

const PIN_Config BoardGpioInitTable[] = {

    Board_RLED   | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,         /* LED initially off             */
    Board_GLED   | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,         /* LED initially off             */
    Board_BTN1   | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,            /* Button is active low          */
    Board_BTN2   | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,            /* Button is active low          */
    Board_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN,  /* External flash chip select    */
    Board_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN,                                              /* UART RX via debugger back channel */
    Board_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,                        /* UART TX via debugger back channel */
    Board_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master out - slave in */
    Board_SPI0_MISO | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,                                            /* SPI master in - slave out */
    Board_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN,                                             /* SPI clock */
    Board_SPI0_CSN  |   PIN_INPUT_EN    | PIN_PULLUP,
/*    Board_SPI1_MOSI | PIN_INPUT_EN | PIN_PULLDOWN,                                             SPI master out - slave in */
/*    Board_SPI1_MISO | PIN_INPUT_EN | PIN_PULLDOWN,                                             SPI master in - slave out */
/*    Board_SPI1_CLK | PIN_INPUT_EN | PIN_PULLDOWN,                                              SPI clock */
/*    UMC_reset         | PIN_INPUT_EN | PIN_PULLUP,    */
    PIN_TERMINATE
};

/* SPI Board */
#define Board_SPI0_MISO             IOID_8          /* RF1.20 */
#define Board_SPI0_MOSI             IOID_9          /* RF1.18 */
#define Board_SPI0_CLK              IOID_10         /* RF1.16 */
#define Board_SPI0_CSN              IOID_23         // IOID_23
#define Board_SPI1_MISO             PIN_UNASSIGNED
#define Board_SPI1_MOSI             PIN_UNASSIGNED
#define Board_SPI1_CLK              PIN_UNASSIGNED
#define Board_SPI1_CSN              PIN_UNASSIGNED 

I have tested SPI CS before. (I guessed CC2650 has problem with reading CS)

I changed SPI CS PIN from IOID_23 to PIN_UNASSIGNED, however, nothing change.

Does anyone have any thought or idea?

Thanks.