ADC output conversion

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

ADC output conversion

8,675 次查看
PCS13
Contributor I

I have the evaluation board of the NXP #s32k116. I am working on the ADC. Now following a RTM sample code I prepared my code on ADC, sw triggered. Now I used channel 0 that PTA0 for the input channel of voltage. Now the screen shot below shows the output values of ADC. The problem is the values remain the same even if the jumpers are not there in pta0, have 5 V jumper from board, 3.3 V jumper or a ground jumper. What am I doing wrong? I tried changing channels. The picture below shows jumper connected to 3 three different channels

channel 0 - pta0 - 5v

channel 1 - pta1 - 0 v

channel 3 - pta7 - 3.3 v

however output remains the same.

i want the adc to read voltages upto 3.3v. 

标记 (1)
0 项奖励
回复
9 回复数

8,656 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @PCS13,

Can you share the project so that I can see the configuration?

What is the content of ADC_0_ChnConfig0?

Can you read the ADC0_SC1A[ADCH] register after the ADC_DRV_ConfigChan?

 

Regards,

Daniel

 

0 项奖励
回复

8,613 次查看
PCS13
Contributor I
how do i share my project?
ADCH is in RW access mode but bin is blank after ADC_DRV_ConfigChan. i am checking in EmbSys Registers. adc_converter_config_t is in default mode.
0 项奖励
回复

8,598 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

You can attach the project in a .zip file here to this thread.

Of you can create a ticket and share it there privately.

 

Regards,

Daniel

0 项奖励
回复

8,553 次查看
PCS13
Contributor I

here i have attached the file

0 项奖励
回复

8,546 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @PCS13,

Thank you for the project.

I have been testing it without any modifications, and it works correctly.

Please measure the input voltage at PTA0 and the VREFH reverence voltage.

You mentioned that you measure 5V input, but the ADC_VREFH macro is set to 3.3V in the project.

I would say you get the correct adcRawValue

8bit ADC: LSB = (VREFH - VREFL) / 256.

But the adcValue is incorrect because of the ADC_VREFH definition.

 

Regards,

Daniel

 

0 项奖励
回复

8,461 次查看
PCS13
Contributor I

hey i did what said. i change the reference high to 5 volts. But its still reading the garbage value whether the jumper in is in or out. i am getting the wrong values in adcRawValue itself. the readings hower around 1100  to 1300 out of 4096. i am suspecting that the board might have some issues. I also checked for channel 3, pta 7. doesn't work

0 项奖励
回复

8,416 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @PCS13,

In the project you sent, you use 8bit ADC, now you are calculating the result using 12bit ADC.

The SW must be configured according to the ADC settings and the actual VREF voltage.

Please measure the ADC input along with the ADC VREF.

And make sure the VREFH is not > VDDA + 0.1V.

Can you share your latest project? Because it seems you have reconfigured it.

 

Thank you,

BR, Daniel

0 项奖励
回复

8,365 次查看
PCS13
Contributor I
 
0 项奖励
回复

8,353 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @PCS13,

I don't see any issues in the project now.

What about the actual measurement (preferably using an oscilloscope during the sampling time) on the ADC input, VREF and VDDA?

There is also a chance that the input has a very high source resistance which impacts the accuracy of the ADC conversion.

 

Regards,

Daniel

0 项奖励
回复