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.

MSP430I2040: Calibrating the MSP430i2040 Embededd Metering EVM

Part Number: MSP430I2040
Other Parts Discussed in Thread: TIDM-TWOPHASEMETER-I2040, TIDM-SERVER-PWR-MON, EVM430-I2040S

Tool/software: WEBENCH® Design Tools

MSP430i2040 Embededd Metering EVM

  •  I used

    - MSP430i2040 Embedded Metering EVM &

    - calibrator-20121120 &

    - Submeter i2040 8k_DC_THD_AUTO_OSR_IAR5.5_customer

    I cannot update "Meter 1 calibration factors"

    When I write the parameters and read again, I get "gibberish"

    write new parameter:

     

    read after write:

     

     

     

  • Hello,

    Please keep in mind that you'll need to enter a percentage (%) increase or decrease in the Meter Error window (excluding the phase correction). Notice the units on the right of the entry boxes. After making changes in this window, the updated calibration factors will be shown in the Meter Calibration Factors window.

    Regards,

    James

    MSP Customer Applications
  • Thanks James for the answer,

    I'm trying to run "i2040-TWO-PHASE-CONFIGURATION" software on "MSP430i2040 Embededd Metering EVM" hardware.
    I have changed all the calibration factor as it appears in "Submeter i2040 8k_DC_THD_AUTO_OSR_IAR5.5_customer"

    #define DEFAULT_V_RMS_SCALE_FACTOR_A 24022 /* 13428 rachamim */
    #define DEFAULT_V_DC_ESTIMATE_A 34 /* 0x0000 rachamim */
    #define DEFAULT_V_AC_OFFSET_A 0 /* 9 rachamim */
    #define DEFAULT_I_RMS_SCALE_FACTOR_A 16701 /* 21777 rachamim */
    #define DEFAULT_I_DC_ESTIMATE_A 39757 /* 0x0000 rachamim */
    #define DEFAULT_I_AC_OFFSET_A 1164634 /* 0 rachamim */
    #define DEFAULT_P_SCALE_FACTOR_A 12826 /* 9368 rachamim */
    #define DEFAULT_BASE_PHASE_A_CORRECTION 7 /* 4 rachamim */ //12

    #define DEFAULT_I_RMS_SCALE_FACTOR_NEUTRAL 24410 /* 21740 rachamim */
    #define DEFAULT_I_DC_ESTIMATE_NEUTRAL 0 /* 0x0002 rachamim */
    #define DEFAULT_I_AC_OFFSET_NEUTRAL 0 /* 11 rachamim */
    #define DEFAULT_P_SCALE_FACTOR_NEUTRAL 12565 /* 9302 rachamim */

    Most data in the meter_status window, is normal :
    RMS voltage : correct
    Frequency : correct
    Except:
    RMS current : incorrect
    Active power : incorrect

    Please, what needs to be changed to make it work.
    Regards,
    Rachamim
  • Hello,

    If you change the calibration factors in the 'metrology-calibration-template.h' file, you need to change SELECTED_STRUCT_CONFIGURATION in the 'metrology-template.h' file (on Line 150 for me). This is a flag in Flash that the metrology_init() function checks  after startup in the 'metrology-setup.c' file. If this flag is not changed, the updated calibration factors in the 'metrology-calibration-template.h' file won't be loaded/used. You can change SELECTED_STRUCT_CONFIGURATION to any 8-bit number, such as 0xA9, 0xB2, 0xC4, 0xA5, etc. (just something different than previous value).

    metrology-template.h (snippet)

    #elif defined(i2040_SUBMETERING_EVM)
     #define NUM_PHASES 1
        #define CONFIGURATION_SINGLE_PHASE
        #undef VOLTAGE_SIGNAL_IS_COMMON
        #undef NEUTRAL_MONITOR_SUPPORT
        #define SELECTED_STRUCT_CONFIGURATION        0xA8
        #define PHASE_1_VOLTAGE_ADC_CHANNEL                 0
        #define PHASE_1_CURRENT_ADC_CHANNEL                 1   
        #define LAST_CHANNEL                               1
        #undef NEUTRAL_CURRENT_ADC_CHANNEL                 
        #undef  CURRENT_CHANNEL_PULSE_OUTPUT 
        #undef UNUSED_ADC_CHANNEL                          
        #undef PHASE_2_VOLTAGE_ADC_CHANNEL                  //1
        #undef PHASE_2_CURRENT_ADC_CHANNEL                      
        #undef PHASE_3_CURRENT_ADC_CHANNEL                      
        #undef TOTAL_ACTIVE_ENERGY_PULSES_PER_KW_HOUR            
        #undef TOTAL_RESIDUAL_POWER_CUTOFF                       
        #undef TOTAL_REACTIVE_ENERGY_PULSES_PER_KVAR_HOUR              
        #undef TOTAL_ACTIVE_ENERGY_SUPPORT
        #undef TOTAL_REACTIVE_ENERGY_SUPPORT
        #undef TOTAL_APPARENT_ENERGY_SUPPORT
        #define PHASE_1_DELAY_SPLIT     167
        //#define NEUTRAL_DELAY_SPLIT     167
    
    
    #endif

    metrology-setup.c (snippet)

    int metrology_init(void)
    {
    #if defined(__MSP430_HAS_ESP430E__)
        /* Make this compatible with devices containing the ESP module, by just turning it off. */
        ESPCTL &= ~ESPEN;
    #endif
    
        /* There should always be a power scaling factor for the first current sensor channel of the
           first phase, whatever type of metrology is being built, and that factor should not be
           0xFFFF. */
    //    if (cal_info->struct_state == 0xFFFF)
    //    {
    //        flash_memcpy((void *) cal_info, (const void *) &calibration_defaults, sizeof(calibration_defaults));
    //        flash_secure();
    //    }
         if(cal_info->struct_state != SELECTED_STRUCT_CONFIGURATION)
        {
            clear_calibration_data( );
            flash_memcpy((void *) cal_info, (const void *) &calibration_defaults, sizeof(calibration_defaults));
            flash_secure();     
        }
    #if defined(SAG_POWER_DOWN_SUPPORT)
        sag_power_down_control();
    #endif
        metrology_state = 0;
        return 0;
    }
    

    After making these changes in the code, you'll also need to rebuild the projects in the following order: (1) emter-toolkit-i2041 (2) emeter-metrology-i2041 3) emeter-metrology-i2041

    Regards,

    James

    MSP Customer Applications

  • Thank you for the answer,


    In my version I did not find the defines:

    #define i2040_SUBMETERING_EVM
    #define CONFIGURATION_SINGLE_PHASE
    #define LAST_CHANNEL                   1
    Please refer to my version (i2040-TWO-PHASE-CONFIGURATION)
    Or send me an updated version.

    Regards,

    Rachamim

  • Hi James,
    Now it's working
    After I changed file "meterilogy_template.h" :
    from:
    #define SD_LIVE_CURRENT_GAIN SD24GAIN
    to
    #define SD_LIVE_CURRENT_GAIN SD24GAIN_16

    Regards,

    Rachamim
  • Hi James,

    Subject : TEMPERATURE_SUPPORT

    I'm trying to run "EnergyLibraryi2040TwoPhaseConfiguration-3.0" software on "MSP430i2040 Embededd Metering EVM" hardware.

    I can not measure temperature.

    It succeeds only with the software version : "Submeter i2040 8k_DC_THD_AUTO_OSR_IAR5.5_customer".

    Please send me all the settings required to measure temperature (TEMPERATURE_SUPPORT).

    I need a new version of "i2040-TWO-PHASE-CONFIGURATION" that includes all the settings to support temperature measurement.

    Please check that it works well before you send me.

    Regards,

    Rachamim

  • Hello James,

    This issue is very urgent

    and i would appreciate your fast response in the manner.

    Regards,

    Rachamim

  • Hi James,

    Another serious problem :

    1.     The "INFO" memory has been erase many times for no reason. (With "EnergyLibraryi2040TwoPhaseConfiguration-3.0" software).

            This destroys the MSP430 component.

    2.    Why when "NEUTRAL_MONITOR_SUPPORT" is undefined  (#undef NEUTRAL_MONITOR_SUPPORT)

           No voltage and current measurements (no ADC interrupts).

    Regards,

    Rachamim

  • Hello Rachamim,

    I apologize for the delayed response. I've been working on validating/testing the upcoming Energy Measurement Library and unfortunately haven't had much extra time.

    First, I'll assume that you're referring to the ported code from the TIDM-TWOPHASEMETER-I2040 design that we shared with you to run on the EVM430-I2040S. Please confirm this so we're on the same page. Whenever you're referring to the original source code for the EVM430-I2040S or code from the TIDM-SERVER-PWR-MON design, please be very clear to point this out.

    The ported code mentioned above was done quickly to allow active/reactive energy to be measured on the EVM430-I2040S and unfortunately was not thoroughly tested due to time constraints.

    Regarding your INFO memory erasure, I've seen this happen when users reset or power cycle the EVM while the calibration factors are getting written to INFO memory. The process for updating the calibration factors in INFO memory happens in the following basic order: copy INFO segment contents into RAM, delete the INFO segment to ensure proper write, write back the INFO segment stored in RAM along with the updated calibration factors. If anything interrupts this process before the INFO memory gets written back from RAM, the device will not start up if the TLV has been erased (TLV is checked at startup in 'low_level_init.c'). For the i20xx devices, the minimum Flash memory segment that can be erased is 1KB, which is the total INFO memory for the i20xx devices.

    I need to dig into the ported code to see what changes can be made to help mitigate the INFO memory from being erased. In the meantime, I would recommend backing up the entire Flash and INFO memory when you use a new device (and track which device the backup image is from since the TLV is device specific). This way, you can always recover it if this happens during development.

    Regards,

    James

    MSP Customer Applications

  • Dear James ,

    Thank you for your response !

     

    First i would like to clarify that the issue i am facing is with the software :

    TIDM-TWOPHASEMETER-I2040  that i am trying to run on  hardware EVM430-I2040S

    so please in your response refer only to this.

    We intend to use this (TIDM-TWOPHASEMETER-I2040) software in our production , thus it is very important that it would work as intended.

     the issues i am facing are  :

    1. using the TIDM-TWOPHASEMETER-I2040 with the  EVM430-I2040S hardware  , i cannot measure TEMPERATURE ( even though i used #defined SUPPORT_TEMPERATURE)

    2. Why when i use  #undef NEUTRAL_MONITOR_SUPPORT in the  TIDM-TWOPHASEMETER-I2040 code ,

        there are no voltage and current measurements ? 

     3. regarding the "erase INFO" issue , thank you for your response 

         but it is a very serious problem for us.

        this issue happens in the  TIDM-TWOPHASEMETER-I2040 version.

        as you stated in your previous response : 

       if anything interrupts this process before the INFO memory gets written back from RAM, the device will not start up if the TLV has been erased (TLV is checked at startup in 'low_level_init.c'). 

       Please fix this issue urgently .

    looking forward to your fast response .

    thank you. 

  • Dear James ,
    Thank you for your response !
    First i would like to clarify that the issue i am facing is with the software :
    TIDM-TWOPHASEMETER-I2040 that i am trying to run on hardware EVM430-I2040S
    so please in your response refer only to this.
    We intend to use this (TIDM-TWOPHASEMETER-I2040) software in our production , thus it is very important that it would work as intended.
    the issues i am facing are :
    1. using the TIDM-TWOPHASEMETER-I2040 with the EVM430-I2040S hardware , i cannot measure TEMPERATURE ( even though i used #defined SUPPORT_TEMPERATURE)

    2. Why when i use #undef NEUTRAL_MONITOR_SUPPORT in the TIDM-TWOPHASEMETER-I2040 code ,
    there are no voltage and current measurements ?

    3. regarding the "erase INFO" issue , thank you for your response
    but it is a very serious problem for us.
    this issue happens in the TIDM-TWOPHASEMETER-I2040 version.
    as you stated in your previous response :
    if anything interrupts this process before the INFO memory gets written back from RAM, the device will not start up if the TLV has been erased (TLV is checked at startup in 'low_level_init.c').
    Please fix this issue urgently .
    looking forward to your fast response .
    thank you.
  • Hello Rachamim,

    Thank you for posting your questions to our E2E forum. However, since we've picked up this discussion via email, I'll go ahead and close out this thread.

    Regards,

    James

    MSP Customer Applications

**Attention** This is a public forum