Hi,
In LPC822_features.h we can see next line:
/* ADC module features */
/* @brief Has ADTrim register */
#define FSL_FEATURE_ADC_HAS_TRIM_REG (0)
so in fsl_adc.h driver we will have no definition of "VoltageRange" parameter:
#if defined(FSL_FEATURE_ADC_HAS_TRIM_REG) & FSL_FEATURE_ADC_HAS_TRIM_REG
adc_vdda_range_t
voltageRange; /*!< Configure the ADC for the appropriate operating range of the analog supply voltage VDDA.
Failure to set the area correctly causes the ADC to return incorrect conversion results. */
#endif /* FSL_FEATURE_ADC_HAS_TRIM_REG. */
And compiler will show error with that "Voltage range" included by peripherlas code generator.
So, is that an errata ? it would be (1), isn't it ?
Thanks,
Asier.
Solved! Go to Solution.
Hi XiangJun,
Thanks for the fast response.
I'm agree with all you sais, but the issue I have is that FSL_FEATURE_ADC_HAS_TRIM_REG definition has 0 default value in LPC822_features.h file.
In your example FSL_FEATURE_ADC_HAS_TRIM_REG = 1 because "base-->trim" code in fsl_adc.c file is not graied.
In my file FSL_FEATURE_ADC_HAS_TRIM_REG = 0 and when peripheral code generator includes ".voltageRange" it reports an error.
It is solved doing #define FSL_FEATURE_ADC_HAS_TRIM_REG (1) in LPC822_features.h file, this way some needed definition are ungraied (activated) in fsl_adc.c file.
Thanks and best regards,
Asier.
Hi,
As you know that the VDD voltage of LPC82x can range from 1.8V to 3.3V, so 1.8V is a working voltage.
First of all, the ADC module of LPC82x defines the TRM register to trim ADC result based on the VDD voltage as following Fig, if the VDD is greater than 2.7V, clear VRANGE bit. if the VDDA is less than 2.7V, set VRANGE bit. In most case, the VDD is greater than 2.7V for example 3.3V, and the default value of VRANGE bit is cleared, so user do not need to write the TRM reg.
In conclusion, it is NOT a errata.
I have tried to compile the adc example, the TRM reg is initialized without any modification for the original code in SDK.
In lpc824_features.h
/* @brief Has ADC Trim register */
#define FSL_FEATURE_ADC_HAS_TRIM_REG (1)
As you can see that the TRM reg is initialized.
I attach the example
If you still have issue, pls post your project so that I can have a review.
Hope it can help you
BR
XiangJun Rong
Hi XiangJun,
Thanks for the fast response.
I'm agree with all you sais, but the issue I have is that FSL_FEATURE_ADC_HAS_TRIM_REG definition has 0 default value in LPC822_features.h file.
In your example FSL_FEATURE_ADC_HAS_TRIM_REG = 1 because "base-->trim" code in fsl_adc.c file is not graied.
In my file FSL_FEATURE_ADC_HAS_TRIM_REG = 0 and when peripheral code generator includes ".voltageRange" it reports an error.
It is solved doing #define FSL_FEATURE_ADC_HAS_TRIM_REG (1) in LPC822_features.h file, this way some needed definition are ungraied (activated) in fsl_adc.c file.
Thanks and best regards,
Asier.