Tool/software:
Hello,
MCU: MSP430FR6043
I want to read the USS ADC raw data to find the minimum and maximum values of the output signal. I retrieved the data (pCapturesBuffer
and maxCapture
) from the structure below.
__persistent USS_Capture_Configuration ussCaptureConfig = { .overSampleRate = USS_OVER_SAMPLE_RATE, .sampleSize = USS_USER_CONFIG_NUMBER_OF_SAMPLES_PER_CAPTURE, .gainRange = USS_GAIN_RANGE, .enableWindowHiComp = USS_ENABLE_WINDOW_HI_COMP, .enableWindowLoComp = USS_ENABLE_WINDOW_LO_COMP, .windowHighThreshold = USS_WINDOW_HIGH_THRESHOLD, .windowLowThreshold = USS_WINDOW_LOW_THRESHOLD, .agcConstant = USS_AGC_CONSTANT, .pCapturesBuffer = &gUSSLEATempMemBlock[0], .maxCapture = (sizeof(gUSSLEATempMemBlock) / sizeof(int16_t)), .isCapAccumulationEnabled = USS_SW_LIB_ENABLE_ACCUMULATION, #if USS_SW_LIB_APP_MAX_ACC_BLOCK .pAccCaptureBuffer = &gUSSLEARAMReservedAccMemBlock[0], #endif };
In the code (see below), I created a new pointer to reference the pCapturesBuffer
address and used it to perform the minimum and maximum value computation.
waterQualitydata.dataLength=gUssSWConfig.captureConfig->maxCapture;
waterQualitydata.TemppCapturesBuffer=ussCaptureConfig.pCapturesBuffer;
waterQualitydata.adcMin=*waterQualitydata.TemppCapturesBuffer;
waterQualitydata.adcMax=*waterQualitydata.TemppCapturesBuffer;
for(i=0;i<waterQualitydata.dataLength;i++)
{
if(waterQualitydata.adcMax<*waterQualitydata.TemppCapturesBuffer)
{
waterQualitydata.adcMax=*waterQualitydata.TemppCapturesBuffer;
}
if(waterQualitydata.adcMin>*waterQualitydata.TemppCapturesBuffer)
{
waterQualitydata.adcMin=*waterQualitydata.TemppCapturesBuffer;
}
waterQualitydata.TemppCapturesBuffer++;
}
After the implementation, FRAM consumption increased by 6.4 KB, solely due to the above code changes.
Could you please help me analyze this.
Regards,
SaKhan