Part Number: MSP430F5529
Tool/software: TI-RTOS
Void MSP_EXP430F5529LP_isrDMA(UArg arg)
{
/* Call the SPI DMA function, passing the SPI handle used for WiFi */
SPI_serviceISR((SPI_Handle) &(SPI_config[1])); //how i can use SPI_serviceISR((SPI_Handle) &(SPI_config[0]))?????
}
///////////.cfg文件里增加
var hwiParams = new halHwi.Params();
hwiParams.arg = 0; //////////////how to change this ??????????????????????????????????
halHwi.create(50, "&MSP_EXP430F5529LP_isrDMA", hwiParams);
/////////////////////////
/*
* =============================== SPI ===============================
*/
/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(SPI_config, ".const:SPI_config")
#pragma DATA_SECTION(spiUSCIBDMAHWAttrs, ".const:spiUSCIBDMAHWAttrs")
#endif
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPIUSCIADMA.h>
#include <ti/drivers/spi/SPIUSCIBDMA.h>
SPIUSCIADMA_Object spiUSCIADMAObjects[MSP_EXP430F5529LP_SPICOUNT]; ///MSP_EXP430F5529LP_SPICOUNT =1
SPIUSCIBDMA_Object spiUSCIBDMAObjects[MSP_EXP430F5529LP_SPICOUNT];
uint8_t spiUSCIADMAscratchBuf[MSP_EXP430F5529LP_SPICOUNT];
uint8_t spiUSCIBDMAscratchBuf[MSP_EXP430F5529LP_SPICOUNT];
const SPIUSCIBDMA_HWAttrs spiUSCIBDMAHWAttrs[MSP_EXP430F5529LP_SPICOUNT] = {
{
.baseAddr = USCI_B0_BASE,
.clockSource = USCI_B_SPI_CLOCKSOURCE_SMCLK,
.bitOrder = USCI_B_SPI_MSB_FIRST,
.scratchBufPtr = &spiUSCIBDMAscratchBuf[0],
.defaultTxBufValue = 0,
/* DMA */
.dmaBaseAddr = DMA_BASE,
/* Rx Channel */
.rxDMAChannelIndex = DMA_CHANNEL_2,
.rxDMASourceTrigger = DMA_TRIGGERSOURCE_18,
/* Tx Channel */
.txDMAChannelIndex = DMA_CHANNEL_0,
.txDMASourceTrigger = DMA_TRIGGERSOURCE_19
}
};
const SPIUSCIADMA_HWAttrs spiUSCIADMAHWAttrs[MSP_EXP430F5529LP_SPICOUNT] = {
{
.baseAddr = USCI_A0_BASE,
.clockSource = USCI_A_SPI_CLOCKSOURCE_SMCLK,
.bitOrder = USCI_A_SPI_MSB_FIRST,
.scratchBufPtr = &spiUSCIADMAscratchBuf[0],
.defaultTxBufValue = 0,
/* DMA */
.dmaBaseAddr = DMA_BASE,
/* Rx Channel */
.rxDMAChannelIndex = DMA_CHANNEL_2,
.rxDMASourceTrigger = DMA_TRIGGERSOURCE_16,
/* Tx Channel */
.txDMAChannelIndex = DMA_CHANNEL_0,
.txDMASourceTrigger = DMA_TRIGGERSOURCE_17
}
};
const SPI_Config SPI_config[] = {
{
.fxnTablePtr = &SPIUSCIBDMA_fxnTable,
.object = &spiUSCIBDMAObjects[0],
.hwAttrs = &spiUSCIBDMAHWAttrs[0]
},
{
.fxnTablePtr = &SPIUSCIADMA_fxnTable,
.object = &spiUSCIADMAObjects[0],
.hwAttrs = &spiUSCIADMAHWAttrs[0]
},
// {NULL, NULL, NULL},
};
/*
* ======== MSP_EXP430F5529LP_initSPI ========
*/
void MSP_EXP430F5529LP_initSPI(void)
{
/*
* NOTE: TI-RTOS examples configure USCIB0 as either SPI or I2C. Thus,
* a conflict occurs when the I2C & SPI drivers are used simultaneously in
* an application. Modify the pin mux settings in this file and resolve the
* conflict before running your the application.
*/
/* SPI CLK */
GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P3, GPIO_PIN2);
/* MOSI/SIMO */
GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P3, GPIO_PIN0);
/* MISO/SOMI */
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3, GPIO_PIN1);
/* SPI CLK */
GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN7);
/* MOSI/SIMO */
GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P3, GPIO_PIN3);
/* MISO/SOMI */
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3, GPIO_PIN4);
SPI_init();
}
i am sure that sigle spi driver is right .But how to use two at the same time?