ADC output conversion

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

ADC output conversion

1,840 Views
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. 

Tags (1)
0 Kudos
Reply
9 Replies

1,821 Views
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 Kudos
Reply

1,778 Views
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 Kudos
Reply

1,763 Views
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 Kudos
Reply

1,719 Views
PCS13
Contributor I

here i have attached the file

0 Kudos
Reply

1,712 Views
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 Kudos
Reply

1,627 Views
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 Kudos
Reply

1,582 Views
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 Kudos
Reply

1,531 Views
PCS13
Contributor I
 
0 Kudos
Reply

1,519 Views
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 Kudos
Reply