Other Parts Discussed in Thread: ADS1291
最近进行SPI读取ADS1291数据,感觉数据读取的频率不是很稳定。考虑是不是使用dma会好一些。
然后看了spi程序,感觉spi已经配置了DMA,想确定下是不是这样的。
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[BOARD_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 = BOARD_SPI0_MOSI,
.misoPin = BOARD_SPI0_MISO,
.clkPin = BOARD_SPI0_SCK,
.csnPin =BOARD_SPI0_CSN
}
};
//spi_config 包含对dma配置???
const SPI_Config SPI_config[BOARD_SPICOUNT] = {
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[BOARD_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[BOARD_SPI0]
}
};
/* SPI function table for SPICC26XXDMA implementation */
const SPI_FxnTable SPICC26XXDMA_fxnTable = {
SPICC26XXDMA_close,
SPICC26XXDMA_control,
SPICC26XXDMA_init,
SPICC26XXDMA_open,
SPICC26XXDMA_transfer,
SPICC26XXDMA_transferCancel
};
SPI_Handle SPI_open(uint_least8_t index, SPI_Params *params)
{
SPI_Handle handle = NULL;
if (isInitialized && (index < SPI_count)) {
/* If params are NULL use defaults */
if (params == NULL) {
params = (SPI_Params *) &SPI_defaultParams;
}
/* Get handle for this driver instance */
handle = (SPI_Handle)&(SPI_config[index]);
handle = handle->fxnTablePtr->openFxn(handle, params);
}
return (handle);
}
SPIHandle = SPI_open(BOARD_SPI0, &SPIparams);
在传输的时候是不是应该使用SPICC26XXDMA_transfer,而不是SPI_transfer();?