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.

MSP430FR2533: Threshold calculated by captivate-library to high after the start-up

Part Number: MSP430FR2533
Other Parts Discussed in Thread: CAPTIVATE-PGMR

Dear Ladies and gentleman,

We are using a MSP430 fr2533, for a Touch button project,

Currently we are encountering a seemingly random behaviour where our device is not detecting a touch after start up.
Sometimes after Boot up (~ every 10. time) touches are not detected until the next power cycle.
In a diagnostic program we can trace the touch detection and a so called PDV1 value that mirrors the filter Count – LTA . In the error cases, the threshold is seemingly calibrated to a high, so that a normal touch is not reaching the it.
After a power- cycle the error is soften gone.

The physical environment in the test scenario stays the same for every power cycle

Are there known reasons that the threshold is calculated so high after the start-up.
Are there any parameters for the captivate-library that may stabilize the threshold?
Are there any known mistakes that might have been made in order to this behaviour to occur?

Thank You for your support

  • Hi Gideon,

    Can you please provide your CAPT_Userconfig.c and .h files?  I can review these and see if anything looks abnormal.

    There is not a known reason why this should occur.  I recommend following the guidelines in the Captivate Technology guide below, specifically the section which discusses tuning sensors and setting the thresholds.  Also, there is additional information about the thresholds in the Design Center GUI when you mouse over and click on the parameter in the tuning tab.

    http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/CapTIvate_Design_Center/latest/exports/docs/users_guide/html/CapTIvate_Technology_Guide_html/markdown/ch_workshop.html#part-2-tuning-sensors 

  • Hello Eddie,

    thanks for the quick replie!

    I attached the userconfig CAPT_Userconfig.c and CAPT_Userconfig.h

    Kind regards,

    Gideon

    6082.CAPT_UserConfig.c
    /* --COPYRIGHT--,BSD
     * Copyright (c) 2016, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     * --/COPYRIGHT--*/
    
    
    // Generated by Captivate Design Center v1_40_00_00 on Tue Oct 10 15:40:14 CEST 2017
    
    
    //*****************************************************************************
    // CAPT_UserConfig.c
    //
    // \version 1.10.00.00
    // Released on March 21, 2017
    //
    //*****************************************************************************
    
    //*****************************************************************************
    //
    // NOTE: This is an automatically generated source code file!  The Captivate
    // Design Center generates the User Configuration file automatically based
    // upon the sensor layout that was created.
    //
    // Changes to this file will be OVERWRITTEN if a you select
    // "Update Existing Project" under "Generate Source Code" in the Design Center.
    //
    // To avoid interference with the code generation process, keep ALL application
    // code external to this file.
    //
    //*****************************************************************************
    
    #include "CAPT_UserConfig.h"
    //#include "param-manager.h"
    //*****************************************************************************
    //
    //! Captivate Element Definitions
    //! All elements in this application are defined below.
    //! Each element has 3 components:
    //!  1) a raw count array (One index per freq. scanned) (uint16_t)
    //!  2) a tuning array (One index per freq. scanned) (tCaptivateElementTuning)
    //!  3) a element structure (tElement)
    //
    //*****************************************************************************
    // Sensor: BTN00, Element: E00
    
    
    
    uint16_t BTN00_E00_RawCnts[CAPT_SELF_FREQ_CNT];
    tCaptivateElementTuning BTN00_E00_Tuning[CAPT_SELF_FREQ_CNT];
    tElement BTN00_E00 =
    {
    	.ui8RxPin = 1,
    	.ui8RxBlock = 0,
        .ui8TouchThreshold = 20,
        .pRawCount = BTN00_E00_RawCnts,
        .pTuning = BTN00_E00_Tuning,
    };
    
    
    //*****************************************************************************
    //
    //! Captivate Time Cycle Definitions
    //! All time cycles in this application are defined below.  Time cycles are
    //! groups of elements that are measured together in parallel in one time slot.
    //! Each cycle has 2 components:
    //!  1) an element pointer array to the member elements (tElement*)
    //!  2) a cycle structure (tCycle)
    //
    //*****************************************************************************
    // Time Cycle: BTN00_C00
    tElement* BTN00_C00_Elements[1] =
    {
        &BTN00_E00,
    };
    tCycle BTN00_C00 =
    {
        .ui8NrOfElements = 1,
        .pElements = BTN00_C00_Elements,
    };
    
    
    //*****************************************************************************
    //
    //! Captivate Sensor Definitions
    //! All sensors in this application are defined below.  Sensors are
    //! groups of time cycles that utilize raw measurement data to create an
    //! abstract sensor type, such as a button, slider, wheel, or prox sensor.
    //! Each sensor has 3 components:
    //!  1) a cycle pointer array to the member time cycles (tCycle*)
    //!  2) a sensor-specific parameter structure (tGenericSensorParams)
    //!  3) a sensor structure (tSensor)
    //
    //*****************************************************************************
    //Sensor: BTN00
    const tCycle* BTN00_Cycles[1] =
    {
        &BTN00_C00,
    };
    
    tButtonSensorParams BTN00_Params;
    tSensor BTN00=
    {
    		 // Basic Properties
    		    .TypeOfSensor = eButtonGroup,
    		    .SensingMethod = eSelf,
    		    .DirectionOfInterest = eDOIDown,
    		    .pvCallback = NULL,
    		    .ui8NrOfCycles = 1,
    			.pCycle = BTN00_Cycles,
    			.pSensorParams = (tGenericSensorParams*)&BTN00_Params,
    		    // Conversion Control Parameters
    		    .ui16ConversionCount = 2000, // bei bestandenen Pr�fung war 1200, sensitivity=medium
    		    .ui16ConversionGain = 200,    // bei bestandenen Pr�fung war 1 (es wird via INITt_Senstivity(); eingestellt)
    		    .ui8FreqDiv = 1,
    		    .ui8ChargeLength = 0,
    		    .ui8TransferLength = 0,
    		    .bModEnable = true,
    		    .ui8BiasControl = 0,
    		    .bCsDischarge = true,
    		    .bLpmControl = false,
    		    .ui8InputSyncControl = 0,
    		    .bTimerSyncControl = false,
    		    .bIdleState = true,
    		    // Tuning  Parameters
    		    .ui16ProxThreshold = 38,
    		    .ui16NegativeTouchThreshold = 2000,
    		    .ui16ErrorThreshold = 2800,
    		    .ui16TimeoutThreshold = 65535,
    		    .ProxDbThreshold.DbIn = 5,
    		    .ProxDbThreshold.DbOut = 1,
    		    .TouchDbThreshold.DbIn = 5,
    		    .TouchDbThreshold.DbOut = 1,
    		    .bCountFilterEnable = true,
    		    .ui8CntBeta = 3,
    		    .bSensorHalt = false,
    		    .bPTSensorHalt = true,
    		    .bPTElementHalt = true,
    		    .ui8LTABeta = 7,
    		    .bReCalibrateEnable = true,
    
    };
    
    
    #if (CAPT_CONDUCTED_NOISE_IMMUNITY_ENABLE==true)
    //*****************************************************************************
    //
    //! \var g_EMCConfig
    //! This structure stores the EMC configuration for this application.
    //
    //*****************************************************************************
    const tEMCConfig g_EMCConfig =
    {
    
    
    	// Conversion Style
    	.selfModeConversionStyle = eMultiFrequencyWithOutlierRemovalAndErrCorrection,
    	.projModeConversionStyle = eMultiFrequencyWithOutlierRemovalAndErrCorrection,
    	
    	// Oversampling Style
    	.selfModeOversamplingStyle = e4xOversampling,
    	.projModeOversamplingStyle = e4xOversampling,
    	
    	// Jitter Filter Enable
    	.bJitterFilterEnable = true,
    	
    	// Noise Thresholds and Calibration Noise Limits
    	.ui8NoiseThreshold = 20,
    	.ui16CalibrationNoiseLimit = 10,
    	.ui8CalibrationTestSampleSize = 8,
    		
    	// Dynamic Threshold Adjustment Parameters
    	.bEnableDynamicThresholdAdjustment = true,
    	.ui8MaxRelThreshAdj = 76,
    	.ui8NoiseLevelFilterEntryThresh = 40,
    	.ui8NoiseLevelFilterExitThresh = 0,
    	.ui8NoiseLevelFilterDown = 6,
    	.ui8NoiseLevelFilterUp = 4,
    	.coeffA = _IQ31(0.0065),
    	.coeffB = _IQ31(0.050)
    };
    #endif
    
    //*****************************************************************************
    //
    //! \var g_pCaptivateSensorArray
    //! This array allows for indexed access to any
    //! sensor in the configuration.
    //
    //*****************************************************************************
    tSensor* g_pCaptivateSensorArray[CAPT_SENSOR_COUNT] =
    {
        &BTN00,
    };
    
    
    //*****************************************************************************
    //
    //! \var g_uiApp
    //! This structure stores the global settings for this application.
    //
    //*****************************************************************************
    tCaptivateApplication g_uiApp =
    {
        .state = eUIActive,
    	.pSensorList = &g_pCaptivateSensorArray[0],
        .ui8NrOfSensors = CAPT_SENSOR_COUNT,
        .ui8AppLPM = LPM0_bits,
        .bElementDataTxEnable = false,
        .bSensorDataTxEnable = false,
        .ui16ActiveModeScanPeriod = 10,
        .ui16WakeOnProxModeScanPeriod = 100,
        .ui16InactivityTimeout = 32,
        .ui8WakeupInterval = 5,
    };
    
    1351.CAPT_UserConfig.h

  • Gideon,

    The conversion count value of 2000 is very high which is likely far too sensitive causing the instability.  Is there a reason this is set so high?  Check out the section in the technology guide above regarding the conversion count and see if you can adjust the conversion count and conversion gain for more stable results.

  • Hello Eddi,

    thanks thank you for your reply!

    The values we are using where determine to pass the EMC-tests and fit the corresponding requirements.
    Do you have a recommendation on how to find the optimal balance between EMC robustness and sensitivity?

    Best regards,

  • Hello Eddi,

    We connect our device to the CAPTIVATE-PGMR PCB.
    We were able to reproduce the Error in this environment.

    What we can see is that the LTA value in the Error case is very unstable (between 2100 and 1900) where else in the cases where the error does not occur the LTA (stable around 1800) does not change a lot.

    As mentioned, this behaviour varies between power cycles. Do you have any Idea why this might happen?

    Testing with default parameters the behaviour is seemingly better. However, for the next EMC test cycle we like to find the exact root cause, so that we can optimize more effectively

    Best regards,

  • We narrowed down the problem to the noise immunity. We figured that when switching of the Noise immunity the error is gone.
    Also by increasing the Noise threshold form 10 to 50, we cannot reproduce the Error.
    Since we want to keep Noise immunity active, because of EMC robustness, we would like to optimize the Noise Threshold and if necessary, the other parameters related to it. Can you please describe a sufficient way to do that?

    We also ran a test where we disabled the Dynamic Threshold Adjustment. Doing that we found that the touch detection became unreliable (detections when not touched

    / Touches not detected at all)

    We do not understand why the behaviour is different to when the Noise Immunity is completely disabled.
    Can you explain the difference in behaviour?

  • Hi Gideon,

    Please see the app note below.  To start, please see if you can get the sensor threshold set correctly without EMC, then we can tackle the EMC issue.  

    https://www.ti.com/lit/an/slaa843a/slaa843a.pdf 

  • Hello,

    In order to further investigate the Problem we examination different variables from the library.

    Doing so we found that if the error occurs the Variable ui16NoiseCount has a Value of over ~300. Where else, if it does not occur the Value is around 50.

    It caught our attention because it was a clear indicator for the problem to occur.

    The only explanation for this Value was in the software itself: CAPT_Type.h

       //

       //! The noise spread observed during a multi-frequency conversion

       //

       uint16_t ui16NoiseCount;

    Can you please further explain the meaning of this Variable and the rise in digits in the error case?

  • Gideon,

    This is a function in the ROM code, which is not accessible by the user.  

    • ui16NoiseCount is populated by this ROM function return pNoiseLevel, it is the max-min in the 4 frequencies after the outlier is removed (if outlier removal is enabled).
    • ui16NoiseCount indicates that there is noise in one or multiple frequencies and if it is higher than the NoiseLevel parameter then the NoiseDetected flag will get set.

  • Form The documentation we cannot find what exactly happens if all four frequencies are disturbed.
    We saw that there are Indicator Flags (bCalibrationError, bSensorNoiseState) that in our Understanding should be set if this happens.
    Testing them in our error case, we found that they are not set. However, there are cases where they are set but not correlating with the error.
    Is the understanding, that if all frequencies are disturbed those two flags should be set, correct?
    Are there any other Indicators that this happened?
    What is the right way to response in the software if this case occurred?

  • Hello Eddie,

    Tracing the proximity behaviour with Captivate connected via Uart to the MSP we found that the Conversation Count Value when touched goes below Proximity Threshold but Proximity in the in the above described Error case, is not detected .See graph below:


    We are already aware that the Proximity Threshold is that unstable because the Noise was to high on all four frequency’s. However, we still cannot explain why the Proximity is not detected.
    Can you please explain?

**Attention** This is a public forum