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.

Power off detection to save data in flash through I2C of MSP430F6779

Other Parts Discussed in Thread: MSP430F6779

Hi,

Any one has idea, How to know the power is going down and going to store my data in external Flash connected on I2C bus within moment.

I am using MSP430F6779 and need to store 20 bytes in external Flash on power off event.

Regards

Bhavdipsinh

  • Hi Bhavdipsih,

    You can do it in the NMI ISR. But, I don't think you can do it reliably since the power is going down and it always takes a little time to erase and program flash memory. The programmed data in flash memory might be corrupted.

    For 20 bytes storage, you can try to use INFO memory of MSP430. The required time might be shorter compared to external flash memory. A large capacitor is also required on VCC since we don't want the power to drop too fast.
  • Pre-Erase flash area while power is good, at start-up. As powerloss handling depends on power source type, regulator (if any) used, voltage drop speed and other cosnumers besides msp, you shall tell more abot such specifics
  • Hi ,
    thanks for your reply. apologize for word "flash" Actually I am going to use EEPROM with I2C interface. I can put sufficient capacitance on power supply, I am making 3.3V from SMPS. I check internal ADC10 in MSP430F6779 for power detection, Is It work for me to detect power down condition and save data into EEPROM. My design is finalize and now difficult to add NMI ISR so please suggest If any other way which you know for it.

    for ,
    I am using SMPS (design by our own and use PI IC for pulse and feedback control), I will check and let you know the available time to power zero from power cut.

    Thanks & Regards
    Bhavdipsinh
  • Hi ,
    I check the power down timing of power supply. because of large capacitor, It takes 800 mSec to down from 3.3V to 1.8V.
    So now please guide.

    Regards
    Bhavdipsinh
  • 800msec is plenty of time for both i2c EEPROM and msp430 flash write. You can implement much simpler than ADC, power loss detector: by monitoring input voltage of switching regulator using pin interrupt. Just connect series resistor between input pin and SMPS input terminal (I/O protection diode will do the rest), implement pin interrupt on falling edge. I would chose resistor value so current flowing is around 10uA. Such way you can "catch" power loss immediately, even before VCC storage capacitor voltage drop. No, you don't need to implement NMI in any case, either ADC or pin interrupt. Hope such guidance helps.
  • 800ms is very long! But also keep in mind that an EEPROM can draw a few mA while writing. But it looks like your storage capacitor is quite huge. You could add a load of 4 or 5mA and see how fast the voltage drops with it.
  • Hi ,
    Thanks for such beautiful explanation.
    I got it. But the problem is our design fixed and we have ready board in our hand. At that time we have seen ADC-12 which is internal ADC for power monitoring purpose in MSP430F6779 and plan to use it to fulfill our EEPROM writing task.

    So, Is there way to use it? otherwise we need to revise our design which makes delay in product delivery.
    Thanks & Regards
    Bhavdipsinh
  • Sure you can monitor power using ADC. If you monitor voltage at comparably low 10Hz rate then you have at least 700ms of time to save data which is still enough. If ADC is dedicated to supply monitoring and device can be locked (with disabled interrupts) for whole EEPROM access time then just do it simply: perform VCC treshold comparison and data saving magic in the ADC ISR. If still have questions - do not hesitate to ask further

  • Thanks ,
    i will do same way and let you know result.
    Thanks for your quick response.

    Regards
    Bhavdipsinh
  • Hi Bhavdipsinh,

    Ilmars is right. If you already use ADC to check power voltage then you can do data saving stuff in the ADC ISR.

    I used to use NMI for some reasons:
    1. To get the shorted delay. MPS430 can check the power voltage automatically and then trigger NMI.
    2. To prevent using ADC. If you use current meter to watch the current consumption waveform then you will realize ADC is not power saving at all.
  • Thanks ,

    I understood, will you provide something to use NMI by check power voltage automatically? Is It detect internal or I need to have some external connection with NMI pin? It work better as compare to ADC which was explain by you.

    Thanks
    Bhavdipsinh
  • Hi Bhavdipsinh,

    No, you don't need external connection to RST/NMI pin.

    The NMI can be triggered by the RST/NMI pin or supply voltage fault. So, you need to study the Power Management Module (PMM). The keywords are SVM and SVS. The basic concept is: NMI can be triggered if DVcc < SVM, and POR can be triggered if DVcc< SVS.

    I am not able to give you example code right now. But I believe you will know how to use it after reading the PMM chapter of MSP430 TRM.

    Please keep in mind that even the time delay is 800ms for voltage drops from 3.3V to 1.8V. But you can not set the comparison voltage to 3.3V due to power noise, especially SMPS. If you choose to compare the voltage at 2.4V then the delay time available is much shorter. This is true no matter ADC or NMI is used.

  • Hi ,

    As per your suggestion,

    I am trying to use NMI routine for power down detection and configure below resisters.

    first, unlock PMM resisters using PMMCTL0.

    then,

    SVSMHCTL: bits number 0,1 & 2.  SVSMHRRL ( set voltage level of 3.02 as per datasheet).

    (is there anything missing in configuration)

    Write Interrupt subroutine for SYSNMI_VECTOR

    Please guide me.

    Thanks

    Bhavdipsinh

  • Hi Bhavdipsinh,

    It is more than 5 years ago last time I used NMI with PMM. Now, I don't remember the detail procedures to configure. I don't have any MSP430 PCB on hand to test it for you. So, you have to study TRM and test it by yourself. Or, ask TI FAE for direct support.

**Attention** This is a public forum