Hi,
We use the KW45 for automotive and recently migrated from SDK 2_12_2 to SDK 2_12_6. And the ADC behavior is not the same.
We use the LPADC to measure a couple things, the board temperature (differential on channel 26) and other single ended channels to measure VBat. Both are measured once per second.
Initially the ADC was completely broken and none of the signals were sampled. I eventually patched the changes to get VBatt measurement and Temperature measurements individually but when both are enabled together, the VBat values are wrong and doesn't change.
I saw that the configurations for measuring both are different and might need re calibration every time I switch to measuring something different. But this didn't seem to help either.
As of now I have the VBatt measurement working with this ADC init function.
void kw45_adc_init(
void)
{
lpadc_config_t adc_config;
vref_config_t vref_config;
VREF_GetDefaultConfig(&vref_config);
/* Initialize the VREF mode. */
VREF_Init(
VREF0,
&vref_config);
VREF_SetTrim21Val(
VREF0,
VREF_TRIM2V1_VALUE_FOR_2P1V);
CLOCK_EnableClock(kCLOCK_Lpadc0);
CLOCK_SetIpSrc(
kCLOCK_Lpadc0,
kCLOCK_IpSrcFro192M);
CLOCK_SetIpSrcDiv(
kCLOCK_Lpadc0,
kSCG_SysClkDivBy10);
LPADC_GetDefaultConfig(&adc_config);
adc_config.enableAnalogPreliminary = true;
adc_config.referenceVoltageSource = kLPADC_ReferenceVoltageAlt2;
adc_config.conversionAverageMode = kLPADC_ConversionAverage128;
LPADC_Init(
ADC0,
&adc_config);
LPADC_PrepareAutoCalibration(ADC0);
LPADC_FinishAutoCalibration(ADC0);
}
Need some help figuring this out. Thanks. We need to measure both accurately periodically. Not sure what else changed with SDK 2_12_6.
Hello,
Was there other modification made on code? or was it only the SDK version? Which IDE are you using?
Regards