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.

[参考译文] MSP430G2955:器件始终开启时、按下按钮点火有问题。

Guru**** 2584165 points
Other Parts Discussed in Thread: MSP430G2955

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1111852/msp430g2955-problem-with-ignition-by-push-button-when-the-device-is-always-on

器件型号:MSP430G2955

大家好。

我们为客户制造的150种热湿度计存在问题、我们使用的是 MSP430G2955。

由于电路由电源适配器和锂电池供电、因此电路始终处于打开状态、通过按下连接到 P1.1的按钮并保持按住6秒钟来完成点火、 另一个按钮连接到 P1.0、根据按下该按钮的时间长度、将器件置于设置模式。

当我加载固件并使用调试器执行测试时、器件会正确打开、当我拔下电源插头并在没有 FET 编程器的情况下将其打开时、器件也会正确打开、但在一天之后器件无法打开、我不知道原因。

我已经尝试了所有操作、使用 while 循环、并将其从此处读取 P1IN、中断、组合中断和读取引脚的状态。 当使用中断时、我注意到 GIE 位没有明显的原因变为零、所以我执行了一个例程来持续检查中断的状态并将其复位。

我最后尝试的是每小时连续重启微控制器、以防止它随着时间的推移而变得无响应、我再次启用 WDT、 但即使所有这些设置都是相同的、在一两天后、器件停止响应、并且不会开启。

此时、我仍然不知道正在发生什么、我不知道它是否会影响附近有钕磁铁(它们用于将器件粘附到冰箱中)的事实。

由于代码范围很广(超过4、000条线路)、我只连接参考点火开关的线路。电路有两个电压调节器、第一个电压调节器使 MSP430G2955始终保持开启、第二个电压调节器在微控制器引脚 P4.7启用时接通电路的其余部分。 很抱歉、代码太乱了、有时是多余的、但我对它做了很多修改、但仍然没有正确调试、这是程序目前的状态。

void Hab_int()
{
    if (__get_SR_register() & GIE){__delay_cycles (1);}      // GIE
    else{__bis_SR_register(GIE);}
    if (P1DIR & BIT0){P1DIR &=~BIT0;}                   // pulsadores
    if (P1DIR & BIT1){P1DIR &=~BIT1;}
    if (P1SEL & BIT0){P1SEL &=~BIT0;}                  // Func Especiales
    if (P1SEL & BIT1){P1SEL &=~BIT1;}
    if (P1SEL2 & BIT0){P1SEL2 &=~BIT0;}                  // Func Especiales
    if (P1SEL2 & BIT1){P1SEL2 &=~BIT1;}
    if (P1IE & BIT1){__delay_cycles (1);}                  // hab interrupcion P1.1
    else {P1IE |= BIT1;}
    if (P1IES & BIT1){P1IES &=~BIT1;}                  // Interrupción por flanco de subida
    if (P1IFG & BIT1){P1IFG &= ~(BIT1);}                // baja flag de interrupción de P1.1


}
void confini()
{
    Hab_int();
    retardo_ver();     ////delay 2 seg
    P3DIR |=BIT7;
    P3OUT |=BIT7;   //Linea CS
    P3DIR |=BIT6;
    P3OUT |=BIT6;   //Linea RD
    P3DIR |=BIT5;
    P3OUT |=BIT5;   //Linea WR
    P3DIR |=BIT4;
    P3OUT |=BIT4;   //Linea DATA
    P1DIR |=BIT5;
    P1DIR &=~BIT4;
    P1OUT |=BIT5;   // pines de comunicacion con el ESP
    P4DIR |=BIT6;
    P4OUT |=BIT6;   // Tx Texas y Rx SIM7070
    P2DIR &=~BIT3;  //Rx Texas y Tx SIM7070
    P4DIR &=~BIT5;
    P4DIR |=BIT4;
    P4OUT |=BIT4;   //CTS entrada RTS salida
    P3DIR &=~BIT3;
    P3DIR |=BIT2;
    P3OUT |=BIT2;      //pines bluetooth
    P2SEL |=BIT2;       //canal ADC para el voltaje de la bateria
    P4DIR |=BIT3;
    P4OUT &=~BIT3;   // pin pwrkey
    P4DIR &=~BIT1;      //señal de bateria
    retardo_ver();      //1/2tiempo necesario pin pwrkey
    P4OUT |=BIT3;
    retardo_ver();
    P4OUT &=~BIT3;      //pulso en  pwrkey
    LCD_comando(2)
    ;retardo_com();     //comando LCD_off
    LCD_comando(1);
    retardo_com();     //comando Sys_en
    LCD_comando(24);
    retardo_com();     //comando RC-256K
    LCD_comando(43);
    retardo_com();     //comando Bias 1/3, 4 comunes
    LCD_comando(227);
    retardo_com();     //comando normal
    LCD_comando(3);
    retardo_com();     //comando LCD_on
    retardo_tecla();
    operativo1=0;
    operativo2=0;
    operativo3=0;
    operativo4=0;
    operativo5=0;
    operativo7=0;
    temporal1=0;
    temporal2=0;
    temporal3=0;
    temporal4=0;
    return;
}

int main(void)
{
    __delay_cycles (1000);
    WDTCTL = WDTPW | WDTHOLD;
    __delay_cycles(1000000UL);
    BCSCTL1 = CALBC1_8MHZ;
    DCOCTL = CALDCO_8MHZ;
    contreset=0;
    estado=0;
    retardo_tecla();            //espero para que se estabilice el inicio
    SDA_configsal;
    SCL_configsal;
    SCL_bajo;
    SDA_bajo;
    retardo_ver();      
    limite=LEER_Ver(0x98);      //I read the EEPROM memory address where I store if the device is on (1) or off (0)

    while (1)
    {
        Hab_int();

        while (estado==0)
        {
            P1DIR=0;
            P2DIR=0;
            P3DIR=0;
            P4DIR=0x01;    //dejo el 4.0 como salida para el pin de activacion
            P4OUT&=~BIT0;   // Turn off the device
            retardo_ver();      //doy tiempo para que se apaguen bien los modulos
            P1DIR &=~BIT0; 
            P1DIR &=~BIT1;   // pulsadores
            SDA_configsal;
            SCL_configsal;
            SCL_bajo;
            SDA_bajo;
            retardo_com();    // estado inicial I2C
            if (limite=='1')
            {
                P4OUT|=BIT0;  //Turn on the device
                confini();
                for(cont=0;cont<32;cont++)  //Clear the LCD Screen
                {
                    escribir_LCD(cont,0);tbit (30000);
                }      
                estado=10;
            }
            else{estado=5;}
        }

        while (estado==5)
        {
            retardo_med();
             Hab_int();
             contreset++;
             if (contreset==5900)
             {
                 WDTCTL = WDTPW;
                 retardo_med();     //delay 1 seg
                 contreset=0;
             }
        }

        while (estado==8)
        {
            if (P1IN & BIT1)
            {
                sostenedor=0;
                configura=0;       //Blanqueo el registro para el tiempo de encendido
                while (sostenedor<=40)
                {
                    retardo_tecla();
                    if (P1IN & BIT0){configura++;}
                    if (P1IN & BIT1){sostenedor++;}
                    else{sostenedor=100;}
                }
                if(sostenedor<99)
                {
                    P4OUT|=BIT0;  //Turn On the device
                    P1DIR &=~BIT1; 
                    P1DIR &=~BIT0;
                    confini();
                    apagador=0;
                    ESC_Ver(0x98,'1'); I write 1 in the EEPROM memory address where I store the state of the device.
                    for(cont=0;cont<32;cont++)
                    {
                    escribir_LCD(cont,0);
                    tbit (30000);
                    }      //Blanqueo la pantalla
                    if (configura==0){estado=10;}
                    else
                    {
                        if (configura<12){estado=140;}
                        else
                        {
                            if (configura<25){estado=100;}
                            else{estado=40;}
                        }
                    }
                    retardo_tecla();
                }
                else{estado=5;}
            }
            else{estado=5;}
            retardo_tecla();
        }
        
.........   more program

#pragma vector=PORT1_VECTOR
__interrupt void P1_ISR(void)
{
  char registro;
  char sostenedor;
  char contadort;
  if (P1IFG & BIT1) // comprobar fuente de la interrupción P1.1
  {
    registro=LEER_Ver(0x98); //indico en memoria que el dispositivo esta apagado
    if (registro=='1')
    {
        sostenedor=0;       //Blanqueo el registro para el tiempo de encendido
        while (sostenedor<=12)
        {
            retardo_tecla();
            P1DIR &=~BIT1;
            if (P1IN & BIT1){sostenedor++;}
            else{sostenedor=100;}
        }
        if(sostenedor<99)
        {
            ESC_Ver(0x98,'0'); //indico en memoria que el dispositivo esta apagado
            limite=LEER_Ver(0x98);      //
            estado=0;
            P4OUT&=~BIT0;       //turn off the device
            apagador=10;
            retardo_ver();
            P1DIR=0;
            P2DIR=0;
            P3DIR=0;
            P4DIR=0x01;    //dejo el 4.0 como salida para el pin de activacion
            P1DIR &=~BIT1; 
            P1DIR &=~BIT0;  // pulsadores
            P1IE |= BIT1;         // habilita la interrupción de P1.1
            P1IES &=~BIT1;        // Interrupción por flanco de subida
            P1IFG &= ~(BIT1);     // baja flag de interrupción de P1.1
        }
    }
    else
    {
        estado=8;
    }
    P1IFG &= ~BIT1; // puesta a cero del flag de interrupción P1.1
  }
  else
  {
      estado=0;
      apagador=10;
      ESC_Ver(0x98,'1'); //indico en memoria que el dispositivo esta encendido
      P4DIR|=BIT7;
      retardo_tecla();
      P4OUT |=BIT7;
      retardo_tecla();
  }
  return;
}
        

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

    您好!

    当器件无响应时、您能否将 FET 连接到它以确定其在代码中的位置? 您能否通过探查电路周围的情况来确定稳压器是否正常运行?

    打开器件的预期机制是什么?  

    您能否尝试在没有连接钕磁铁的情况下运行您的器件、以查看其是否相关?

    此致、

    Evan

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

    您好 Evan

    是的、当器件未响应时、我可以连接 FET、但在断开 FET 后如何进行监控?

    当我连接电池时、器件会打开、从那一刻起、器件始终保持通电状态、我首先连接电池、让其充满电、然后加载程序、之后器件始终保持开启状态、一两天之后、器件将停止使用按钮开启。

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

    当器件停止工作时、电池的电压是多少? 是否是电池电量耗尽了? 您是否已检查 SVS 设置?

    Evan

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

    问候语

    在最坏的情况下、电池电压保持在3V 以上。 我尚未完成任何 SVS 配置、因此器件必须采用出厂配置。

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

    我在关注所有状态时遇到了一些问题、但如果您达到 Estado=5、并且在100分钟内看不到按钮按压、则会触发看门狗复位。 我提到这一点是因为您提到过、超过1小时的空闲时间是通过/失败点。

    看门狗复位会发出 PUC 复位、该复位(在 F2系列中)不会复位所有器件。 您可能应该审核您的启动序列、以确保将所有外设置于已知状态、即使它们已经在运行。 在大多数情况下、只需使用"="(而不是"|=")设置外设寄存器即可完成此操作。 ADC 尤其需要更多、但您可能没有使用它。

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

    你好 Bruce

    [引用 userid="47378" URL"~μ C/support/microcontrollers/msp-low-power-microcontrollers-group/msp-group/msp111852/msp430g2955-probleme-with -igny-by-button-when the -device-always on always on/4121840=100分钟、但如果您看不到、则会看到"Estado=1840"按钮触发、但如果您想重置按钮、则会发生此情况[引述]

    是的、我这样做只是为了防止微控制器在一段时间后停止响应、但很显然、有些器件(并非所有器件)甚至在一小时前冻结、并且永远不会再次打开。

    [引用 userid="47378" URL"~μ C/support/microcontrollers/msp-low-power-microcontrollers-group/msp411852/msp430g2955-problem-with -igny-by-button-when the -device-always on always on /4121840#4121840]即使您已经将所有外设置于启动状态、也可能会确认它们是否处于启动状态。 在大多数情况下、只需使用"="(而不是"|="")设置外设寄存器即可完成此操作

    好的、 我将执行该操作并尝试。