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.

back up during brown out

Other Parts Discussed in Thread: MSP430F2274, MSP430F5418, MSP430FR5969

Hi, we are trying to implement data backup during brown out.  Basically, we want to store important data like errors during brown out..

the below are the basic functions used for this  purpose.

void init (void)

{

    // Open PMM registers for write access

    PMMCTL0_H = 0xA5;

    SVSMHCTL = SVSHE + SVMHE  ;

    SVSMLCTL = SVSLE + SVMLE ;

    PMMRIE = SVMLIE + SVMHIE;

    // Lock PMM registers for write access

    PMMCTL0_H = 0x00;

}

 

#pragma vector=SYSNMI_VECTOR

__interrupt void sysNmiISR(void)

{

switch (SYSSNIV)

  {

      case SVMLIFG:         // (0x0020)  /* SVM high side interrupt flag */

       FLASH_WriteFlash(a,(uint8_t *)FLASH_SEG_D_START,1);

         break;

      case 0x0004:       // (0x0001)  /* SVS and SVM low side Delay expired interrupt flag */

         break;

  }

}

i am expecting the above isr to to execute when I switch off my board and store the values into non volatile memory.  But, it is not getting executed.   Please let me know what could be wrong.  

Thanks,

  • Hi Krish,

    In your ISR, your case selection says "SVMLIFG".  But you should be looking for a value in SYSSNIV not the value of a flag.  SYSSNIV = 0x0002 represents SVMLIFG being set.  But your comment says "high side".  I think you want to look for SVMHIFG, which corresponds to a SYSSNIV value of 0x0004.  The SVMHIFG event almost certainly occurs before the SVMLIFG event during a power down.

    You should also consider setting the high-side threshold higher, say for 2.4V Vin.  Use the highest setting for the voltage threshold.  That should give you as much notice as possible that power is going away.  I assume you have enough capacitance (or some other power control) to give you enough energy to write to flash as the supply voltage falls.

    But still leave the low-side threshold low.  What MCU are you using?  Hopefully the low-side setting corresponds to 1.8V Vin.  (Not true on F54xx non-A models.)

    For robustness I would still let the SVSL assert reset.  So use PMMRIE = SVMHIE + SVSLPE;

    Jeff

  • Thanks Jeff for the reply. 

    I increased the vcore output voltage using  PMMCTL0_L = PMMCOREV0+PMMCOREV1; and it started working.  Probably the vcore was not sufficient for the processor to

    trigger SNMI interrupt.  I still need to figure it out. Here is the code.

    void InitSNMIVector(void)

    {

        // Open PMM registers for write access

        PMMCTL0_H = 0xA5;

        // Set SVS/SVM high side new level

        PMMCTL0_L = PMMCOREV0+PMMCOREV1;

        SVSMHCTL =   SVMHE + SVSMHRRL0+SVSMHRRL1+ SVSMHRRL2 ;

        PMMRIE =  SVMHIE;

        // Lock PMM registers for write access

        PMMCTL0_H = 0x00;

    }

     

    #pragma vector=SYSNMI_VECTOR

    __interrupt void sysNmiISR(void)

    {

       // a is just for testing

        uint8_t a[1];

        a[0] = 0xdd;

        FLASH_WriteFlash(a,(uint8_t *)FLASH_SEG_D_START,1);

        switch (SYSSNIV)

        {

            case 0x0002: 

                a[0] = 0xaa;

                FLASH_WriteFlash(a,(uint8_t *)FLASH_SEG_B_STOP,1);

                break;

            case 0x0004:       

                a[0] = 0x77;

                FLASH_WriteFlash(a,(uint8_t *)FLASH_SEG_C_STOP,1);

                break;

             default:

                break;

        }

    }

    Thanks....

  • Hi, I am using MSP430F2274 and I would like to implement a function that react "doing something" in case of supply problems (e.g. zapper).

    I think that brown out could be used to detect such supply problems, but I did not find any datasheet, user guide or application note that describe BOR or SYSNMI_VECTOR or anything related to it.

    Can you please help me?

    Thanks!

  • Hi Marco

    I was using MSP430f5418 for my application when i posted the above query.  

    Please see slau144.pdf ( MSP430x2xx Family User's Guide (Rev. I) ). 

    In Chapter 9, Supply Voltage Supervisor (SVS) it does mention that, 

    The SVS can be configured to set a flag or generate a POR reset when the supply voltage or external voltage drops below a
    user-selected threshold.  So, the bit you should be monitoring is SVSFG of SVSCTL register. 

    However, it is  also mentioned that SVS is implemented in selected msp430x2xx devices.  

    There is some problem downloading MSP430F2274 data sheet from TI website.  If you have this data sheet yourself  please check for SVS in it. 

    Thanks,

  • Thank you for your reply Krish.

    Now I am trying to do the same with a MSP430FR5969, entering in an interrupt if Vcc goes under a certain threshold.

    I saw on slau367a.pdf that the register are different from MSP430x2xx. As far as I understand, the interrupt should be initialized in the SYSRSTIV interrupt vector register (or in SYSSNIV, I'm not sure) with interrupt event SVSHIFG. So I don't get how should I declare the interrupt, neither how should I set the thresholds level.

    Is there someone who has experience with this?

    Thank you.

  • Update:

    I have just find out how to use SVS interrupt on MSP430FR5969. This is my code:

    int main(void)
    {
      WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
      P1DIR=BIT0;                                                       // P1.0 Led
      PMMCTL0 = PMMPW + PMMLPRST + SVSHE;   // PMM password; SVSH triggers a system NMI; SVSH always enabled
      while(1)
      {
        __bis_SR_register(LPM3_bits + GIE);      //LPM3 with interrupt enabled
        P1OUT=0;                                     // Led off
      }
    }

    #pragma vector=SYSNMI_VECTOR;
    __interrupt void SVS (void)
    {
      switch (__even_in_range(SYSSNIV,0x12))       // Efficient switch-implementation
      {
        case  SYSSNIV_SVS:                                    // Vector 2: SVS
        P1OUT=BIT0;                                                 // Led on
        PMMIFG &= ~SVSHIFG;                                // Reset Interrupt Flag
        __bic_SR_register_on_exit(LPM3_bits);     // Exit LPM3
        break;
      }
    }

    This code does exactly what I expected: when the power supply drops below SVSH threshold it enters in the interrupt. I just discovered that the threshold is around 1.85V, and I was wondering if it is possible to change it (and how). Another issue is that when I try to rise the supply voltage after the interrupt the code turn off the led and enter again in LPM3, but it doesn't enter again in the interrupt if the power supply drops below SVSH threshold again. Do you know why?

    Thank you!

**Attention** This is a public forum