用simpelink写spi驱动,不成功。
在launchpad板子上,用simplelink基于freertos的spiloopback例程,也看不到寄存器值的改变。
下面的代码流程应该是对的吧,但是测量不到clk时钟的输出,也看不到寄存器的改变。
SPI_Handle spi;
SPI_Params spiParams;
SPI_Transaction spiTransaction;
unsigned char transmitBuffer[MSGSIZE] = "Hello, this is master SPI";;
unsigned char receiveBuffer[MSGSIZE];
bool transferOK;
// GPIO_init();
//GPIO_write(Board_GPIO_DSP3V3_EN, 1);
//GPIO_write(Board_GPIO_LED0, 1);
SPI_init(); // Initialize the SPI driver
SPI_Params_init(&spiParams); // Initialize SPI parameters
spiParams.dataSize = 8; // 8-bit data size
spi = SPI_open(Board_SPI0, NULL);
if (spi == 0) {
while (1); // SPI_open() failed
}
// Fill in transmitBuffer
//GPIO_write(Board_GPIO_LED0, 0);
spiTransaction.count = MSGSIZE;
spiTransaction.txBuf = (void *)transmitBuffer;
spiTransaction.rxBuf = (void *)receiveBuffer;
transferOK = SPI_transfer(spi, &spiTransaction);
if (!transferOK) {
// Error in SPI or transfer already in progress.
// GPIO_write(Board_GPIO_LED0, 1);
}
songfeng zhang:
确认啦,这个是OK的。
Winter Yu:
回复 songfeng zhang:
是例程能正常跑了??还有什么问题吗??
如果您认为此问题已被解答,请在“这是否解答您的问题” 后,点击“是”按钮。 感谢您对TI的大力支持!