Other Parts Discussed in Thread: CC2652P, , SYSCONFIG
Hi,
We are using LAUNCHXL-CC1352P to develop applications in CC2652P.
We need two SPI communications for our project. How to implement custom SPI configuration in sysconfig tool?
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.
Hi,
We are using LAUNCHXL-CC1352P to develop applications in CC2652P.
We need two SPI communications for our project. How to implement custom SPI configuration in sysconfig tool?
Not sure what you mean by two SPI communications.
I you need one SPI bus but two different CSn signal, you can configure the SPI in sysConf to be 3-wire SPI, and then you can let the application control two different CSn (one for each peripheral you need to communicate with).
If you need to use two SPI peripherals because you have two separate SPI buses, you simply add two SPI in SysConf and configure them for the pins you want to use.
Example Code:
#define SPI_MSG_LENGTH (3) unsigned char masterRxBuffer0[SPI_MSG_LENGTH]; unsigned char masterTxBuffer0[SPI_MSG_LENGTH] = {0x55, 0xff, 0x55}; unsigned char masterRxBuffer1[SPI_MSG_LENGTH]; unsigned char masterTxBuffer1[SPI_MSG_LENGTH] = {0xff, 0x55, 0xff}; void *masterThread(void *arg0) { SPI_Handle spi0; SPI_Handle spi1; SPI_Params spiParams; SPI_Transaction transaction0; SPI_Transaction transaction1; /* Open SPI as master (default) */ SPI_Params_init(&spiParams); spiParams.frameFormat = SPI_POL0_PHA1; spiParams.bitRate = 4000000; spi0 = SPI_open(CONFIG_SPI_0, &spiParams); spi1 = SPI_open(CONFIG_SPI_1, &spiParams); //memset((void *) masterRxBuffer, 0, SPI_MSG_LENGTH); transaction0.count = SPI_MSG_LENGTH; transaction0.txBuf = (void *) masterTxBuffer0; transaction0.rxBuf = (void *) masterRxBuffer0; transaction1.count = SPI_MSG_LENGTH; transaction1.txBuf = (void *) masterTxBuffer1; transaction1.rxBuf = (void *) masterRxBuffer1; while(1) { SPI_transfer(spi0, &transaction0); SPI_transfer(spi1, &transaction1); } }
Siri