最近在学习cc1310Launch Pad的SPI功能,导入SDK中的SPImaster的例子,发现两块CC1310板卡之间可以相互通信。
问题: 但使用CC1310读取其他的支持SPI的器件(这里使用MAX31865芯片读取温度值)在发送成功的情况下收不到芯片发回来的数据。
目前查看设置都没有什么问题,我想请问一下在使用SPI读取外部器件时,需要特别注意哪些问题?我使用CCS建立的工程。目前找不到是什么原因造成的,能提供点思路吗?
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.
最近在学习cc1310Launch Pad的SPI功能,导入SDK中的SPImaster的例子,发现两块CC1310板卡之间可以相互通信。
问题: 但使用CC1310读取其他的支持SPI的器件(这里使用MAX31865芯片读取温度值)在发送成功的情况下收不到芯片发回来的数据。
目前查看设置都没有什么问题,我想请问一下在使用SPI读取外部器件时,需要特别注意哪些问题?我使用CCS建立的工程。目前找不到是什么原因造成的,能提供点思路吗?
你检查一下你的slave地址 以及frame format
不好意思!没有收到回复提示以为还没有人问答。检查了slave的地址,没有问题。frame format中除了配置极性的选择,还有什么是需要注意的?下面这个文件是我用逻辑分析仪采集了波形。与MAX31865的芯片手册中的波形,看起来也没有太大的问题。这个问题卡了我好久,现在没有解决思路了。CC1310与SPI接口.xlsx
还有MAX31865的芯片手册
// From board.c
PIN_Config BoardGpioInitTable[] = {
Board_CSN_0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, // Ensure SPI slave 0 is not selected
Board_CSN_1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL // Ensure SPI slave 1 is not selected
}
const *** ***[CC2650_SPICOUNT] = {
{ // Use SPI0 module with default chip select on Board_CSN_0
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0,
.intPriority = ~0,
.swiPriority = 0,
.defaultTxBufValue = 0,
.powerMngrId = PERIPH_SSI0,
.rxChannelIndex = UDMA_CHAN_SSI0_RX,
.txChannelIndex = UDMA_CHAN_SSI0_TX,
.mosiPin = Board_SPI0_MOSI,
.misoPin = Board_SPI0_MISO,
.clkPin = Board_SPI0_CLK,
.csnPin = Board_CSN_0
}
// From your_application.c
static void taskFxn(UArg a0, UArg a1)
{
SPI_Handle handle;
SPI_Params params;
SPI_Transaction transaction;
PIN_Id csnPin1 = PIN_ID(Board_CSN_1);
uint8_t txBuf[] = "Hello World"; // Transmit buffer
// Init SPI and specify non-default parameters
SPI_Params_init(¶ms);
params.bitRate = 1000000;
params.frameFormat = SPI_POL1_PHA1;
params.mode = SPI_MASTER;
// Configure the transaction
transaction.count = sizeof(txBuf);
transaction.txBuf = txBuf;
transaction.rxBuf = NULL;
// Open the SPI and perform transfer to the first slave
handle = SPI_open(Board_SPI, ¶ms);
SPI_transfer(handle, &transaction);
// Then switch chip select pin and perform transfer to the second slave
SPI_control(handle, ***, &csnPin1);
SPI_transfer(handle, &transaction);
}
以上code 可以去参考,抓一下是否波形输出正常
这很奇怪,你片选信号接了吗?没有什么思路建议你自己去调调看了