You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MSP430FR2310作为I2C从机无法响应主机请求的问题排查求助

MSP430FR2310 I2C从机无法响应主机通信问题

硬件与测试背景

  • 主机:MSP430FR2355(Launchpad板),已完成验证:与Adafruit RTC通信时,逻辑分析仪确认起始条件、从机地址、读/写位发送正确,RTC能正常回复ACK并返回数据
  • 从机:MSP430FR2310,设定地址为0x45

问题现象

主机与FR2310连接后,逻辑分析仪显示主机发送的起始条件、地址、读/写位均正常,但从机回复NACK。为排查从机是否识别到I2C信号,编写测试代码期望起始条件触发时切换P1.4引脚状态,但引脚从未变化,说明从机未检测到起始条件。

从机配置代码及ISR

#include "intrinsics.h"
#include "msp430fr2310.h"
#include <msp430.h>

#define SLAVE_ADDRESS 0x45
volatile unsigned char data;

int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;  // Stop watchdog timer 

    P1DIR |= BIT4;             // Set P1.4 as output
    P1OUT &= ~BIT4;            // Drive P1.4 low initially

    UCB0CTLW0 |= UCSWRST;      // Put into software reset for config

    P1SEL1 &= ~BIT3;           // Set P1.3 as I2C SCL
    P1SEL0 |= BIT3;

    P1SEL1 &= ~BIT2;           // Set P1.2 as I2C SDA
    P1SEL0 |= BIT2;

    UCB0CTLW0 &= ~UCTR;        // Put device into receive mode
    UCB0CTLW0 &= ~UCMST;       // Put device into slave mode
    UCB0CTLW0 |= UCMODE_3 | UCSYNC;    //Put into I2C mode and synchronous mode
    UCB0I2COA0 = SLAVE_ADDRESS | UCOAEN;    //Set slave address and enable it
    UCB0I2COA0 |= UCGCEN;      //General call response enable

    UCB0CTLW0 &= ~UCSWRST;     //Take out of software reset

    UCB0IE |= UCRXIE0 | UCSTTIE;    // Enable RX interrupt and start bit interrupt
    __enable_interrupt();      // Enable global interrupts

    //loop forever
    while(1) {
   
    }
}

//ISR to trigger on any I2C event (start condition, slave address, RX, etc.)
#pragma vector=EUSCI_B0_VECTOR
__interrupt void EUSCI_B0_ISR(void)
{
    if (UCB0IFG & UCSTTIFG) {  
        P1OUT |= BIT4;         // Toggle P1.4 if start condition is recognized
        UCB0IFG &= ~UCSTTIFG;  // Clear flag
    }
}

已尝试的排查措施

  • 调整中断配置参数
  • 使用示波器检测I2C总线的SCL/SDA信号
  • 更换不同的从机地址测试
  • 查阅MSP430FR2355与FR2310的官方数据手册

内容的提问来源于stack exchange,提问作者Kellen Hurley

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 19:37:14