在使用这个sdk 时候, 加上spi的初始化以后,void bspSpiOpen(uint32_t bitRate, uint32_t clkPin),就死机。不知道什么原因。
{
SPI_init();
if (spiHandle == NULL)
{
/* Configure SPI as master, 1 mHz bit rate*/
SPI_Params_init(&spiParams);
spiParams.bitRate = 1000000;
spiParams.mode = SPI_MASTER;
spiParams.transferMode = SPI_MODE_BLOCKING;
spiParams.frameFormat = SPI_POL0_PHA0;
/* Attempt to open SPI. */
spiHandle = SPI_open(Board_SPI0, &spiParams);
if (spiHandle == NULL)
{
Task_exit();
}
}
}
Viki Shi:
可以试下用SPI driver来实现SPI功能,而不是bspSpiOpen,另外这个版本比较旧了,建议下载最新版再测试
Gerry Fan:
回复 Viki Shi:
/* Board specific settings for CC26xx SensorTag, PCB version 1.01** Note that since this module is an experimental implementation,* board specific settings are directly hard coded here.在bsp_spi.c文件中这句话,是不是就是不建议采用直接这样使用:SPI_init()SPI_transfer () SPI_Open
而是使用类似 下面的直接操作寄存器类型的。int bspSpiWrite(const uint8_t *buf, size_t len)
{while (len > 0){uint32_t ul;
SSIDataPut(BLS_SPI_BASE, *buf);SSIDataGet(BLS_SPI_BASE, &ul);len–;buf++;}
return (0);
}
YiKai Chen:
回复 Gerry Fan:
一般建议直接采用SPI_init/SPI_Open/SPI_transfer
edson yen64:
回复 YiKai Chen:
請問SPI_init/SPI_Open/SPI_transfer能直接放在應用層做使用嗎?~比方說放在multi_role.c 內的static void multi_role_init(void)……做執行