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.

求助MSP430G2553硬件I2C问题

Other Parts Discussed in Thread: MSP430G2553

我用MSP430G2553烧入I官方的demo I2C 例程,G2互相通信的,为什么不能通信,需要外接上拉电阻吗?

我配置内部上拉电阻,为啥P1.6只有2V?而且也不能通信。

求助啊  什么地方配置错误了吗?

  • 2V是因为条线帽的原因  无语勒   但是配置上拉还是不行

  • 楼主所说不能通信具体有什么现象呢?单步调试一下,看能不能进入RX中断,最好外接一个上拉电阻,10k或者4.7k试下

  • 有一个建议的方法:

    有一个MCU在发数据,用示波器看波形电压和时序是否正确,如果不正确,先找发送的原因,如果正确,那就找接受方的原因,内置上拉电阻在切换的过程中,可能会因为配置不当而造成电平无法正常建立。

    谢谢!

  • MSP430的这个代码分了两部分,会不会是你两个MCU用了同一个代码,看下面的描述;

    附件是代码,再一个就是外加上拉4.7K的电阻吧,内部的上拉电阻值太大,大约35K,不太符合I2C标准。

    msp430g2xx3_uscib0_i2c_04.c

    // MSP430G2xx3 Demo - USCI_B0 I2C Master RX single bytes from MSP430 Slave
    //
    // Description: This demo connects two MSP430's via the I2C bus. The master
    // reads from the slave. This is the master code. The data from the slave
    // transmitter begins at 0 and increments with each transfer. The received
    // data is in R5 and is checked for validity. If the received data is
    // incorrect, the CPU is trapped and the P1.0 LED will stay on. The USCI_B0
    // RX interrupt is used to know when new data has been received.
    // ACLK = n/a, MCLK = SMCLK = BRCLK = default DCO = ~1.2MHz

    msp430g2xx3_uscib0_i2c_05.c

    // MSP430G2xx3 Demo - USCI_B0 I2C Slave TX single bytes to MSP430 Master
    //
    // Description: This demo connects two MSP430's via the I2C bus. The master
    // reads from the slave. This is the slave code. The TX data begins at 0
    // and is incremented each time it is sent. An incoming start condition
    // is used as a trigger to increment the outgoing data. The master checks the
    // data it receives for validity. If it is incorrect, it stops communicating
    // and the P1.0 LED will stay on. The USCI_B0 TX interrupt is used to know
    // when to TX.
    // ACLK = n/a, MCLK = SMCLK = default DCO = ~1.2MHz

  • 谢谢  问题解决了  就是因为上拉电阻的原因 必须外接上拉电阻  为什么配置单片机内部的上拉电阻就不行? 内部是35K的 太大了吗?

  • 请问这个上拉电阻该怎么加,我两块板子的P1.6和P1.7都加了上拉电阻,但是运行后,两个板子还是无法通信啊,测试两个管脚根部没波形啊