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.

[参考译文] SPI 模式?

Guru**** 2562120 points
Other Parts Discussed in Thread: MSP430FR2355

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/804880/spi-modes

主题中讨论的其他器件:MSP430FR2355

大家好、

我在使用 SPI 时遇到问题(目前只学习如何在 MSP430FR2355上使用 SPI)。

我的场景是 SPI 主器件连接到示波器并查看结果。

因此、如果我将 SPI 模式设置为 EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_HIGH、所有操作都正常、但如果我将其设置为 EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_LOW、我的程序会在 while 循环中停止:

while (!EUSCI_B_SPI_getInterruptStatus (EUSCI_B1_BASE、
EUSCI_B_SPI_Transmit 中断);

发送数据时的数据速率。

此模式的用途是什么? 请有人解释一下。 此外、程序被永远锁定在 while 循环中的原因可能是什么?

我已经多次检查、只有这种更改才会使它永久循环、没有其他任何东西。

我的 SPI 配置如下所示:


//初始化主设备
EUSCI_B_SPI_initMasterParam SPI_param ={0};
spi_param.selectClockSource = EUSCI_B_SPI_CLOCKSOURCE_SMCLK;
SPI_param.clockSourceFrequency = CS_getSMCLK ();
spi_param.desiredSpiClock = 1000000;
SPI_param.msbFirst = EUSCI_B_SPI_MSB_FIRST;
SPI_param.clockPhase = EUSCI_B_SPI_PHASE_DATA_Changed_ONFIRST_capted_on_next;
SPI_param.clockPolarity = EUSCI_B_SPI_CLOCKPOLARITY_INACT_HIGH;
SPI_param.spiMode = EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_HIGH;
EUSCI_B_SPI_initMaster (EUSCI_B1_BASE、&SPI_param);

//启用 SPI 模块
EUSCI_B_SPI_ENABLE (EUSCI_B1_BASE);

EUSCI_B_SPI_clearInterrupt (EUSCI_B1_base、EUSCI_B_SPI_Receive_interrupt);

//启用 USCI_B1 RX 中断
EUSCI_B_SPI_enableInterrupt (EUSCI_B1_BASE、EUSCI_B_SPI_Receive_interrupt);

//等待从器件初始化
_DELAY_CYCLES (100);