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.

[参考译文] MSP430FR5869:无法从SPI读取数据

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/642514/msp430fr5869-could-not-read-data-from-spi

部件号:MSP430FR5869

大家好,我想通过SPI在从属模式下读写MSP430FR5869数据。 但读取过程始终返回0或255。

MSP430的源代码如下:

//选择SPI GPIO

P2SEL0 |= BIT4 | BIT5 | BIT6;

UCA1CTLW0 |= UCSWRST;

UCA1CTLW0 |= UCMSB+UCSYNC;

UCA1CTLW0 &=~UCSWRST;

UCA1IE |= UCRXIE;

UCA1IE |= UCTXIE; 

我不明白为什么MSP上的SPI只能写入但无法读取。

谢谢,Cong Nga Le

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

    从数据表的表6-52和6-53中,您将注意到P2SEL1位应设置为UCA1功能。 确保UCCKPL和UCCKPH位与主设备的设置一致。 请参阅TI提供的代码示例。

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

    感谢Ryan,

    我只需用您的评论更新我的代码,如下所示,它有效。

    //选择SPI GPIO
    
    P2SEL1 || BIT4 | BIT5 | BIT6; 

    谢谢!

    Cong Nga Le