Part Number: SIMPLELINK-CC2640R2-SDK
Other Parts Discussed in Thread: CC2640R2F
Tool/software: TI-RTOS
Hi everyone,
I am living a trouble with SPI driver and my sdk version 1_35.
There is one master (CC2640R2F) and two slaves in my system. These two slaves shares the same SCLK,MOSI,MISO. One slave uses POL0_PHA1 and other uses POL1_PHA1 spi frame format.
typedef enum CC2640R2_LAUNCHXL_SPIName {
CC2640R2_LAUNCHXL_SPI0 = 0,
CC2640R2_LAUNCHXL_SPI1,
CC2640R2_LAUNCHXL_SPICOUNT
} CC2640R2_LAUNCHXL_SPIName;
typedef enum CC2640R2_LAUNCHXL_SPIName {
CC2640R2_LAUNCHXL_SPI0 = 0,
CC2640R2_LAUNCHXL_SPI1,
CC2640R2_LAUNCHXL_SPICOUNT
} CC2640R2_LAUNCHXL_SPIName;
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2640R2_LAUNCHXL_SPICOUNT] = {
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
.intPriority = ~0,
.swiPriority = 0,
.powerMngrId = PowerCC26XX_PERIPH_SSI0,
.defaultTxBufValue = 0,
.rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
.txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
.mosiPin = CC2640R2_LAUNCHXL_SPI0_MOSI,
.misoPin = CC2640R2_LAUNCHXL_SPI0_MISO,
.clkPin = CC2640R2_LAUNCHXL_SPI0_CLK,
.csnPin = CC2640R2_LAUNCHXL_SPI0_CSN,
.minDmaTransferSize = 10
},
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
.intPriority = ~0,
.swiPriority = 0,
.powerMngrId = PowerCC26XX_PERIPH_SSI1,
.defaultTxBufValue = 0,
.rxChannelBitMask = 1<<UDMA_CHAN_SSI1_RX,
.txChannelBitMask = 1<<UDMA_CHAN_SSI1_TX,
.mosiPin = CC2640R2_LAUNCHXL_SPI1_MOSI,
.misoPin = CC2640R2_LAUNCHXL_SPI1_MISO,
.clkPin = CC2640R2_LAUNCHXL_SPI1_CLK,
.csnPin = CC2640R2_LAUNCHXL_SPI1_CSN,
.minDmaTransferSize = 10
}
};
const SPI_Config SPI_config[CC2640R2_LAUNCHXL_SPICOUNT] = {
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC2640R2_LAUNCHXL_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC2640R2_LAUNCHXL_SPI0]
},
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[CC2640R2_LAUNCHXL_SPI1],
.hwAttrs = &spiCC26XXDMAHWAttrs[CC2640R2_LAUNCHXL_SPI1]
},
};
const uint_least8_t SPI_count = CC2640R2_LAUNCHXL_SPICOUNT;
I am using CC2640R2_LAUNCHXL_SPI0 for slave which uses POL0_PHA1 and CC2640R2_LAUNCHXL_SPI1 for slave which uses POL1_PHA1.
I opened SPI interface by calling;
handle0 = SPI_open(CC2640R2_LAUNCHXL_SPI0,¶ms0) handle1 = SPI_open(CC2640R2_LAUNCHXL_SPI1,¶ms1)
I checked both spi handle, these are not equal to NULL.
When i try to write or read something by SPI, the program seems to be stuck in SPI_transfer function. I did not get SPI_Status value because, SPI_transfer never return.
Everything works when only one slave is connected to SPI (I mean that, i did one spi_open for one slave and other slave is deasserted)
I only drive one spi slave at one time.
I am wondering that Does the issue occurs because of two different spi handle shares the same spi bus?
Is it permitted that two spi handle use the same SPI bus ?
Do you have any suggestion that why this problem occurs ?
Is there any way to change spi frame format without reopening the spi interface ?
Thanks for your attention.
Have a nice day