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.

MSP430FR5989: ESI recalibration issue: calibration not happening fast enough

Part Number: MSP430FR6989
Other Parts Discussed in Thread: MSP430FR5989

Hi Everyone,

I am developing an AMR project using ESI and I am using MSP430FR5989. I have adapted the code from FlowESI GUI's code generator tool. I am facing some issues regarding the ESI interface.
The issues are mentioned below:
1) DAC value setting always waits for the rotation of the disc, is there a workaround to bypass this requirement?
2) Initial ESI calibration is taking long time and is not stable, is there a better mechanism available?
3) The number of pulses per rotation of the meter wheel is found to be different every time we test. i.e. sometimes its 4 interrupts per turn,
sometimes its 2 and on rare occasions its 6

i am looking for a functionality where I can calibrate the AMR device one time and then i can attach AMR device to other meters for testing.

I have attached ESI config and calibration files for reference. I have tried adding DAC and noise values from our experiments but
the sensing does not seem to work.

Attachment details:
- esiCalibration.c - contains the calibration logic for ESI interface
- esiConfig.c - contains the PSM and TSM and configuration logic for ESI
- esiCalibration contains 3 functions which have values needed for DAC, noise and recalibration respectively,
They are initialSetDAC( ), initialNoiseLevel( ), initialReCalibration( ).

Any help is appreciated.

- Lovelesh

ESIConfig.zip

  • Part Number: MSP430FR6989

    Tool/software: Code Composer Studio

    HI All,

    I am trying to read wheel rotation using ESI. i have adapted my code from FlowESI GUI generated code. I am facing a peculiar issue while sensing the wheel rotations. sometime my code counts 2 interrupts per rotation and sometimes its 4 interrupts per rotations. 

    I have attached the ESI config and Calibration files generated and modified by me. 

    - Lovelesh

    0211.ESIConfig.zip

  • Hello Lovelesh,

    I am looking into this issue and will provide feedback shortly.
  • Hello Lovelesh,

    I am looking into this issue and will provide feedback shortly.

  • Hi Eddie,

    Can you provide me some assistance regarding the above issue. I am facing this problem with multiple meters.

    Regards,
    Lovelesh
  • Lovelesh,

    I apologize for the long delay.

    1. No, there is no workaround for this. The device needs to see both cases where there is metal present and when there is not metal present.

    2. Yes, a windowed SAR approach could be used for faster calibration. The example code should already have a function available for this, but you will need to modify the code to implement it.

    3. The variation of the interrupts of wheel rotation will vary based on where the rotation of the disc is when measurement begins. It could be that the disc was started on a metal surface or not.

    In regards to calibrating the AMR device once and then using with different discs, this will not be possible due to the unit to unit variation of the coils. Each AMR and disc will need to be a matched pair.
  • Hi Eddie,

    Thanks for the reply. I will try out your SAR approach for faster recalibration. According to newer approach, I recalibrate the AMR device every time I keep it on a new meter. This has solved my problems to some extent.

    However I didnot understand why my code is showing different number of interrupts/pulses for a single turn on the same meter. Is this due to TSM  being 500 Hz and recal frequency being 2340 Hz?

    This behaviour is not observed on FlowESI GUI and it gives the correct number of interrupts per turn for a specific meter. I am not able to replicate this behaviour in my code. Is it due to dynamic recalibration. In my current code, I take noise values from my previous experiments and the device set its DAC value dynamically and then I add recalibration values from my previous experiments.

    Below is my esiConfig code. 

    	TSM_Auto_cal();
    #ifdef DEBUG
    	serialDebugWriteNL("TSM auto Calibration done");
    #endif
    
    //	Find_Noise_level();
    	initialNoiseLevel();
    #ifdef DEBUG
    	serialDebugWriteNL("noise level setting done");
    #endif
    
    	
    	// User need to run the meter to finish the calibration.
    	Set_DAC();
    //	initialSetDAC();
    #ifdef DEBUG
    	serialDebugWriteNL("set DAC value done");
    #endif
    
    	// Set the ESI control registers for normal operation
    	gAFE1Settings = ESI_AFE1_INITPARAMS_DEFAULT;
    	gAFE1Settings.inverterSelectOutputAFE1 = ESI_INVERTER_FOR_AFE1_ENABLE;
    	gAFE1Settings.midVoltageGeneratorSelect = ESI_MID_VOLTAGE_GENERATOR_ENABLED;
    	gAFE1Settings.excitationCircuitSelect = ESI_EXCITATION_CIRCUIT_ENABLED;
    	ESI_AFE1_init(&gAFE1Settings);
    	
    	// Set sampling frequency to User selected sampling frequency
    	gTSMSettings = ESI_TSM_INITPARAMS_DEFAULT;
    	gTSMSettings.startTriggerSelection = ESI_TSM_START_TRIGGER_ACLK_OR_SOFTWARE;
    
    	// 72 Hz sampling frequency (max flow possible = 2500 L/hour, so max rotation frequency = 6 Hz for all meters)
    	gTSMSettings.startTriggerAclkDivider = ESI_TSM_START_TRIGGER_DIV_66;
    //	gTSMSettings.startTriggerAclkDivider = ESI_TSM_START_TRIGGER_DIV_450;
    	ESI_TSM_init(&gTSMSettings);
    	
        // Initialization of PSM.
    	gPSMSettings = ESI_PSM_INITPARAMS_DEFAULT;
    	gPSMSettings.count0Select = ESI_PSM_CNT0_ENABLE;
    	gPSMSettings.count0Reset = ESI_PSM_CNT0_RESET;
    	gPSMSettings.count1Select = ESI_PSM_CNT1_ENABLE;
    	gPSMSettings.count1Reset = ESI_PSM_CNT1_RESET;
    	gPSMSettings.count2Select = ESI_PSM_CNT2_ENABLE;
    	gPSMSettings.count2Reset = ESI_PSM_CNT2_RESET;
    
    
    
    	ESI_PSM_init(&gPSMSettings);
    	
    
    	// indication for a call from InitScanIF
    	gRecalFlag |= INITIAL_AFE2_RECALIBRATION;
    
    	ESI_clearInterrupt(ESI_INTERRUPT_FLAG_Q6_BIT_SET);
    	ESI_enableInterrupt(ESI_INTERRUPT_Q6_BIT_SET);
    	ESI_enable();
    
    	// wait for the ESISTOP flag
    	__bis_SR_register(LPM3_bits+GIE);
    
    //	ReCalScanIF();
    	initialReCalibration();
    #ifdef DEBUG
    	serialDebugWriteNL("ReCalibration done");
    #endif

    All functions starting with initial are experimental values obtained while keeping the AMR device on the meter. Using this approach, I sometimes find the number of interrupts vary for a particular meter. 

**Attention** This is a public forum