LPC822_features.h errata with ADTrim register definition value ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC822_features.h errata with ADTrim register definition value ?

Jump to solution
1,700 Views
asier
Contributor III

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.

0 Kudos
Reply
1 Solution
1,661 Views
asier
Contributor III

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.

View solution in original post

0 Kudos
Reply
2 Replies
1,677 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

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.

xiangjun_rong_0-1632452859262.png

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)

xiangjun_rong_1-1632453446488.png

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

 

0 Kudos
Reply
1,662 Views
asier
Contributor III

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.

0 Kudos
Reply