cc2640r2f的spi程序烧录进去发送为一百位数据,只能接收到前十位。程序在其他芯片上可以正常发送接收,硬件烧录其他程序也能接收完整的数据。为什么烧录发送一百位数据的程序就只能接收到十位??
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
cc2640r2f的spi程序烧录进去发送为一百位数据,只能接收到前十位。程序在其他芯片上可以正常发送接收,硬件烧录其他程序也能接收完整的数据。为什么烧录发送一百位数据的程序就只能接收到十位??
附上相关示例代码
Example transferring 12-bit SPI frames. The transmit and receive buffers are of type uint16_t.
SPI_Transaction spiTransaction;
uint16_t transmitBuffer[BUFSIZE];
uint16_t receiveBuffer[BUFSIZE];
bool transferOK;
SPI_Params_init(&spiParams);
spiParams.dataSize = 12;
spi = SPI_open(Board_SPI0, &spiParams);
...
spiTransaction.count = someIntegerValue;
spiTransaction.txBuf = transmitBuffer;
spiTransaction.rxBuf = receiveBuffer;
transferOK = SPI_transfer(spi, &spiTransaction);
if (!transferOK) {
// Error in SPI or transfer already in progress.
}
下面是从机Receive 100 bytes over SPI in SPI_MODE_BLOCKING模式
SPI_Handle handle; SPI_Params params; SPI_Transaction transaction; uint8_t rxBuf[100]; // Receive buffer // Init SPI and specify non-default parameters SPI_Params_init(¶ms); params.bitRate = 1000000; params.frameFormat = SPI_POL1_PHA1; params.mode = SPI_SLAVE; // Configure the transaction transaction.count = 100; transaction.txBuf = NULL; transaction.rxBuf = rxBuf; // Open the SPI and perform the transfer handle = SPI_open(Board_SPI, ¶ms); SPI_transfer(handle, &transaction);