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.

cc1310 SPI 通讯

Other Parts Discussed in Thread: CC1310

直接写了CC1310的SPI测试程序!运行后3个IO都没有输出!代码如下:

/*
* ======== echoFxn ========
* Task for this function is created statically. See the project's .cfg file.
*/
Void taskFxn_SPI(UArg arg0, UArg arg1)
{
unsigned int ret;
// uint16_t temperature;
uint8_t txBuffer[2]={0x55,0x88};
uint8_t rxBuffer[2];


SPI_Handle handle;
SPI_Params params;
SPI_Transaction spiTransaction;
SPI_Params_init(&params);
params.bitRate = 1000000;
handle = SPI_open(Board_SPI0, &params);
if (!handle) {
System_printf("SPI did not open");
}
else {
System_printf("SPI Initialized!\n");
}


spiTransaction.count = 2;
spiTransaction.txBuf = txBuffer;
spiTransaction.rxBuf = rxBuffer;


while(1)
{
ret = SPI_transfer(handle, &spiTransaction);
if (!ret) {
System_printf("Unsuccessful SPI transfer");
}
else {
System_printf("SPI Bus fault\n");
}

Task_sleep(500000 / Clock_tickPeriod);
}

/* Deinitialized spi */
SPI_close(handle);
System_printf("SPI closed!\n");


System_flush();
}

/*!*****************************************************************************
* @brief Application main entry point
*
* @param none
*
* @return int - Should never return
******************************************************************************/
int main(void)
{
/* Locals */
Task_Params taskParams;

/* Do PIN init before starting the kernel */
PIN_init(BoardGpioInitTable);


/* Call board init functions. */
Board_initGeneral();
Board_initSPI();

/* Configure task.
Task_Params_init(&taskParams);
taskParams.stack = myTaskStack;
taskParams.stackSize = sizeof(myTaskStack);
Task_construct(&myTask, taskFxn, &taskParams, NULL);

*/


/* Configure task. */
Task_Params_init(&taskParams);
taskParams.stack = myTaskStack;
taskParams.stackSize = sizeof(myTaskStack);
Task_construct(&myTask, taskFxn_SPI, &taskParams, NULL);

/* Start kernel. */
BIOS_start();

/* Should never get here; include a return to keep the compiler happy */
return 0;
}

  • 目前没有单独的SPI例程,在CC1310DK下面有用SPI 驱动LCD的例程,供参考

    http://e2e.ti.com/support/embedded/tirtos/f/355/t/505689

  • 具体是哪三个IO口?

    关于SPI驱动的介绍,文档还是蛮详细的。

    http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/tirtos/2_21_00_06/exports/tirtos_full_2_21_00_06/products/tidrivers_cc13xx_cc26xx_2_21_00_04/docs/doxygen/html/_s_p_i_c_c26_x_x_d_m_a_8h.html