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.

[参考译文] LP-MSPM0G3507:无 SPI 通信

Guru**** 2553450 points
Other Parts Discussed in Thread: MSPM0G3507

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1541308/lp-mspm0g3507-no-spi-communication

器件型号:LP-MSPM0G3507
Thread 中讨论的其他器件:MSPM0G3507

工具/软件:

您好:  
我尝试对 MSP 进行编程、以使用 SPI_CONTROLLER_REGISTER_FORMAT 示例与 CAN 器件进行通信。 我 使用了与 SPI_Controller_writeReg 类似的格式、但使用单字节。 似乎由于 SPI 通信不正确而陷入了无休止的循环。 当使用调试器进行测试时、它会停止  

  while (gControllerMode!= idle_mode){
  __ WFI ();
}
 
uint8_t* SPI_write (uint8_t writeCmduint8_t data){
  静态 uint8_t result[2]
  gControllerMode = TX_REG_ADDRESS_WRITE_MODE;
  gTxBuffer[0]= data;
  gTxByteCount = 1
  gRxByteCount = 1
  gRxIndex = 0
  gTxIndex = 0

  DL_SPI_clearInterruptStatus (SPI_0_INST、DL_SPI_INTERRUPT_TX);
  DL_SPI_transmitData8 (SPI_0_INST、writeCmd)//写入
  DL_SPI_enableInterrupt (SPI_0_INST、DL_SPI_INTERRUPT_TX);

 
  while (gControllerMode!= idle_mode){
  __ WFI ();
}


这使我假设这可能是由于 SPI CS 或 PICO POCI 接线不正确所致 。 我已 确认连接到正确的针脚、因此我不确定如何解决此问题。您会推荐什么?  
此致、
Leah
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    如果从 SPI 代码示例开始:

    C:\ti\mspm0_sdk_2_05_00_05\examples\nortos\LP_MSPM0G3507\driverlib\spi_controller_multibyte_fifo_poll

    可以看到 PICO 引脚和时钟引脚上的 SPI 波形。

    使用调试器进行测试时、它停止在 

    对于中断更改变量、请添加 Volatile:

    volatile uint8_t gControllerMode = 0;

    此外、您还需要确认是否启用 SPI NVIC 中断。

    每个字节发送或触发 Tx FIFO 触发电平将进入 SPI 的 Tx 中断。

    同时、您可以尝试使用逻辑分析仪监控 SPI PICO、以确认 SPI 总线上发送了数据。

    对于 SPI 中断应用、请参阅此示例:

    C:\ti\mspm0_sdk_2_05_00_05\examples\nortos\LP_MSPM0G3507\driverlib\spi_controller_echo_interrupts