Hello,
We are experiencing a strang issue with the SPI0 interface.
CC1310 is working in SPI slave mode. The issue appears in SPICC26XXDMA_transfer() when the interrupt of the CSN pin is configured - the interrupt is fired immediately after that and since the interrupt is disabled in the interrupt callback, this is later causing communicaiton problems. Now the werid part is that the issue is only apparent on about 50% of the PCBs we've tested (30-40).
I've discovered an easy solution that works on all PCBs, but I want to know what causes the problem. The fix is to use SPI1 intead of SPI0 on the same pins and with the same configuraiton.
Below is an extract of the SPI configuration:
#define SPICOUNT 2
#define SPI0 0
#define SPI1 1
SPICC26XXDMA_Object spiCC26XXDMAObjects[SPICOUNT];
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[SPICOUNT] =
{
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
.intPriority = ~0,
.swiPriority = 0,
.powerMngrId = PowerCC26XX_PERIPH_SSI0,
.defaultTxBufValue = 0xFF,
.rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
.txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
.mosiPin = SPI0_MOSI,
.misoPin = SPI0_MISO,
.clkPin = SPI0_CLK,
.csnPin = SPI0_CSN,
.minDmaTransferSize = 1
},
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
.intPriority = ~0,
.swiPriority = 0,
.powerMngrId = PowerCC26XX_PERIPH_SSI1,
.defaultTxBufValue = 0xFF,
.rxChannelBitMask = 1<<UDMA_CHAN_SSI1_RX,
.txChannelBitMask = 1<<UDMA_CHAN_SSI1_TX,
.mosiPin = SPI0_MOSI,
.misoPin = SPI0_MISO,
.clkPin = SPI0_CLK,
.csnPin = SPI0_CSN,
.minDmaTransferSize = 1
},
};
const SPI_Config SPI_config[SPICOUNT] =
{
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[SPI0]
},
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[SPI1],
.hwAttrs = &spiCC26XXDMAHWAttrs[SPI1]
},
};
The original setup is:
SPI_Params spiParams;
SPI_init();
SPI_Params_init(&spiParams);
spiParams.frameFormat = SPI_POL1_PHA1;
spiParams.mode = SPI_SLAVE;
spiParams.transferCallbackFxn = spiTransferCallback;
spiParams.transferMode = SPI_MODE_CALLBACK;
spiParams.bitRate = 2000000;
spiHandle = SPI_open(SPI0, &spiParams);
And the fix is:
SPI_Params spiParams;
SPI_init();
SPI_Params_init(&spiParams);
spiParams.frameFormat = SPI_POL1_PHA1;
spiParams.mode = SPI_SLAVE;
spiParams.transferCallbackFxn = spiTransferCallback;
spiParams.transferMode = SPI_MODE_CALLBACK;
spiParams.bitRate = 2000000;
spiHandle = SPI_open(SPI1, &spiParams);
Thank you for your help,
Borislav