Using ADC with 0-3.3V input on MXRT-1170-EVK board

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Using ADC with 0-3.3V input on MXRT-1170-EVK board

跳至解决方案
521 次查看
AnweshaPanda
NXP Employee
NXP Employee

I am trying the demo example 'lpadc high sample rate sample signal cm7'

In the sdk it is mentioned that the max possible input to the ADC should be 1.8V. 

How can I change it to 3.3 V i.e. what and where do I need to change the program to make it happen as my sensors output signals in the range of 0-3.3V?

 

0 项奖励
回复
1 解答
394 次查看
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @AnweshaPanda,

Bit 13 of the CMDL register is precisely what needs to be changed. But considering that you are using the "lpadc high sample rate sample signal cm7" example code, it's much easier and effective to change the commandConfig variable that is already used in that code to modify this register. On line 149 of the "lpadc_high_sample_rate_sample_signal.c" file, you can change the value of commandConfig.sampleScaleMode from kLPADC_SampleFullScale to kLPADC_SamplePartScale as shown:
EdwinHz_0-1690256502674.png

The next line, "LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, 1U, &commandConfig);" will then set up the registers with a part scale input rather than a full scale for your ADC module.

BR,
Edwin.

在原帖中查看解决方案

0 项奖励
回复
3 回复数
407 次查看
AnweshaPanda
NXP Employee
NXP Employee

Hello @EdwinHz,  

 

Thanks for the answer. 

Hello, our vref is 1.8. Where in the code I need to change? I think I need to change the 13th bit of CMDL register. Is it possible for you to share the snippet? 

395 次查看
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @AnweshaPanda,

Bit 13 of the CMDL register is precisely what needs to be changed. But considering that you are using the "lpadc high sample rate sample signal cm7" example code, it's much easier and effective to change the commandConfig variable that is already used in that code to modify this register. On line 149 of the "lpadc_high_sample_rate_sample_signal.c" file, you can change the value of commandConfig.sampleScaleMode from kLPADC_SampleFullScale to kLPADC_SamplePartScale as shown:
EdwinHz_0-1690256502674.png

The next line, "LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, 1U, &commandConfig);" will then set up the registers with a part scale input rather than a full scale for your ADC module.

BR,
Edwin.

0 项奖励
回复
495 次查看
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @AnweshaPanda,

The RT1170 supports ADC inputs of at most VREF, which has a maximum operating voltage of 1.89V. This is why the SDK mentions that you the input should not exceed 1.8V.

However, what you can do is reduce the input voltage from 3.3V. The RT1170 has an integrated scaling option that will reduce the input voltage by a factor of 30/64. As mentioned on Section "87.7.13.3" of the Reference Manual, a 3.3V ADC input will be scaled down to 1.54V. Therefore, by enabling CSCALE as well as supplying VREFH with 1.54V, you will get an appropriate digital conversion for your sensor.

EdwinHz_0-1689978806419.png

 

BR,
Edwin.

0 项奖励
回复