关于CC2650的SPI打开失败
协议栈自带的spi驱动,每次用图片的Spi_open() 函数,都打开失败,GREEN_LED闪烁,请问是什么
原因
有没有先调用Board_initSPI();
请看下面截图,程序能正常运行的。
spi_open打开没有问题,但是我想读传感器的设备ID,总是读出的是0,图片里面的读写函数有问题吗?传感器片选一直是拉低的,并且已经power on了,求解答
_RREG是读寄存器的指令
RegAddress是寄存器的地址
SPI数据传输的API是SPI_transfer(),请参考SPI.c和 SPI.h中的注释,了解具体使用方法。
* ## Transferring data #
* Data transmitted and received by the SPI peripheral is performed using
* SPI_transfer(). SPI_transfer() accepts a pointer to a SPI_Transaction
* structure that dictates what quantity of data is sent and received.
*
* @code
* SPI_Transaction spiTransaction;
*
* spiTransaction.count = someIntegerValue;
* spiTransaction.txBuf = transmitBufferPointer;
* spiTransaction.rxBuf = receiveBufferPointer;
*
* ret = SPI_transfer(handle, &spiTransaction);
* if (!ret) {
* System_printf("Unsuccessful SPI transfer");
* }
* @endcode