LPC822_features.h errata with ADTrim register definition value ?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC822_features.h errata with ADTrim register definition value ?

ソリューションへジャンプ
1,705件の閲覧回数
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 件の賞賛
返信
1 解決策
1,666件の閲覧回数
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 件の賞賛
返信
2 返答(返信)
1,682件の閲覧回数
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 件の賞賛
返信
1,667件の閲覧回数
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 件の賞賛
返信