我正在使用开发板iwr1843boost和例程Traffic Monitoring,SDK版本3.6.1.0,我已经能够运行可视化工具并获得了例程输出的数据。然后我试图在此例程中启用spi模块以便将数据发送到msp430,但是,当我在例程中添加了启用spi模块的代码后,MSS通常在Sensor Start后2分钟内抛出错误。
以下是我在例程中添加的代码,分别添加到"MmwDemo_initTask()"和"TrackerDemo_transmitProcessedOutput()"
/*The following code is inserted into 'MmwDemo_initTask()'*/ SPI_init(); // Initialize the SPI SPI_Params spiParams; SPI_Params_init(&spiParams); spiParams.mode = SPI_SLAVE; spiParams.frameFormat = SPI_POL0_PHA0; spiParams.dataSize = 8; spiParams.pinMode = SPI_PINMODE_3PIN; spiParams.shiftFormat = SPI_MSB_FIRST; spiParams.dmaEnable = (uint8_t)1U; spiParams.dmaHandle = gMmwMssMCB.dmaHandle; spiParams.u.slaveParams.dmaCfg.txDmaChanNum =1U; spiParams.u.slaveParams.dmaCfg.rxDmaChanNum =0U; gMmwMssMCB.spiHandle = SPI_open(0, &spiParams); if (!gMmwMssMCB.spiHandle) { System_printf("SPI did not open"); }
/*The following code is inserted into 'TrackerDemo_transmitProcessedOutput()'*/ if(result->numTargets > 0) { uint32_t a = (uint32_t)128 ; // data, just for reference { SPI_Transaction spiTransaction; spiTransaction.count = sizeof(a); spiTransaction.txBuf = &a; spiTransaction.rxBuf = NULL; bool ret; ret = SPI_transfer(spiHandle, &spiTransaction); if (!ret) { System_printf("Unsuccessful SPI transfer\n"); } } }
Mss抛出的错误信息如下图。
根据崩溃时的堆栈情况,代码似乎是在函数MIBSPI_transferGroupDisable(mmwave_sdk_03_06_01_00-LTS\packages\ti\drivers\spi\src\mibspi_dma.c的2418行)中崩溃的。
我该如何避免例程在spi通信时崩溃?