[讨论] msp430f5529 rtos 无法驱动spi

CY   2016-3-15 16:51 楼主
使用msp430f5529运行ti-rtos驱动spi仿真发现从spi的RXBUF中有数据,程序运行时无法跳过SPI_transfer(),运行到__no_operation();。

主要的taskFxn函数如下。

void pm25ld020taskFxn(UArg arg0, UArg arg1) {


GPIO_write(ZKS_GASSENSOR_X2_SPI_PM25LD020_CE,
ZKS_GASSENSOR_X2_PM25LD020_ENABLE);

SPI_Handle spi_handle_pm25ld020;
Bool transferOK;
SPI_Params spiParams_pm25ld020;
SPI_Params_init(&spiParams_pm25ld020);
spiParams_pm25ld020.transferMode = SPI_MODE_BLOCKING;
spiParams_pm25ld020.transferCallbackFxn = NULL;
spiParams_pm25ld020.bitRate = 8000000;
spi_handle_pm25ld020 = SPI_open(Board_SPI_PM25LD020, &spiParams_pm25ld020);

SPI_Transaction spi_transaction_pm25ld020;
UChar transmitBuffer[1] = { 0x9f };
UChar receiveBuffer[4] = { 0x04 };
spi_transaction_pm25ld020.count = 4;
spi_transaction_pm25ld020.txBuf = (Ptr) transmitBuffer;
spi_transaction_pm25ld020.rxBuf = (Ptr) receiveBuffer;
transferOK = SPI_transfer(spi_handle_pm25ld020, &spi_transaction_pm25ld020);
__no_operation();
GPIO_write(ZKS_GASSENSOR_X2_SPI_PM25LD020_CE,
ZKS_GASSENSOR_X2_PM25LD020_DISABLE);
if (!transferOK) {
/* Error in SPI transfer or transfer is already in progress */
}

}

回复评论

暂无评论,赶紧抢沙发吧
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复