ADC reading

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

ADC reading

Jump to solution
1,479 Views
Ayaz
Contributor III

Hi 

I am using the S32k344 evaluation board.

I am trying to read an input signal via ADC,

my setup:

EMIOS_GPT -----> BCTU ----> ADC. 

based on the RM I have scaled the adc_clk into 80MHz. prescaler 2 

during the calibrations adc_clk into 40MHz. prescaler 4 

and i have disabled the bctuhwtriggered before the calibrations and i have enabled it after that.

i am aslo using hwaveraging.

i am trying to read tow value ,the bandgab and an input value.

i am reading the value from FIFO result , watermark value , which i set it into 1.

but i do have some doubt regrade to what is watermark value used for ??

the issue i am seeing is that the reading value is getting corrupted despite the accuracy is not good.

i have attached my project , i hope you may have a solution for this problem. 

1 Solution
1,304 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

I added code in vBCTU_FIFO_Notification to determine whether the order is reversed by comparing the values ​​of adc_interface_au16Data[0] and adc_interface_au16Data[1].

If no breakpoint is set during debugging, adc_interface_au16Data[0] is always smaller than adc_interface_au16Data[1]. 

So I think this phenomenon caused by debugging and breakpoints will not interfere with the program running during non-debugging.

View solution in original post

0 Kudos
Reply
7 Replies
1,443 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

BCTU asserts a watermark interrupt request if the number of valid FIFO entries exceeds the watermark level (FIFOWM[WM_FIFOn]).

64.3.3.9 Read ADC result from FIFO.png

Do you think the sampling results are not accurate? Are the values of the sampling results too different?

Which S32K3 evaluation board are you using? ADC0_P0 (PTD1) seems to be floating and not connected to a fixed voltage signal.
Try modifying the ADC channel and what is the sampling result of the ADC Rotary Potentiometer(ADC_POT0) on the evaluation board?

I see that you turned off hardware averaging after the calibration was completed.
Adc_Sar_Ip_SetAveraging(0, false, ADC_SAR_IP_AVG_4_CONV);
What is the ADC sampling result after turning on hardware averaging?

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
1,427 Views
Ayaz
Contributor III

Hi 

Thanks for the input.

Which S32K3 evaluation board are you using?

I am using the S32K344 , S32K3X4EVB-T172 Evaluation Board for Automotive General Purpose | NXP Semiconductors.

Do you think the sampling results are not accurate? Are the values of the sampling results too different? 

Yes, the input values fluctuate. it is 3 v input it will give 2,5v and 3,5v and 4v and so on. despite the flipping as well with the bandgap voltage. the first result should always be the bandgap and the second the input voltage. but what happens is that I am getting the first one the input voltage and the bandgap after some time.

Skærmbillede 2024-03-21 135156.pngSkærmbillede 2024-03-21 135202.png

What is the ADC sampling result after turning on hardware averaging? 

we only need averaging during the calibrations.

0 Kudos
Reply
1,305 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

I added code in vBCTU_FIFO_Notification to determine whether the order is reversed by comparing the values ​​of adc_interface_au16Data[0] and adc_interface_au16Data[1].

If no breakpoint is set during debugging, adc_interface_au16Data[0] is always smaller than adc_interface_au16Data[1]. 

So I think this phenomenon caused by debugging and breakpoints will not interfere with the program running during non-debugging.

0 Kudos
Reply
1,292 Views
Ayaz
Contributor III
Thanks for your help
0 Kudos
Reply
1,389 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

I didn’t bring S32K3X4EVB-T172 with me today, so tested your project on S32K3X4EVB-Q257 board.
I adjusted the onboard ADC_POT0 to 3v and connected the signal with ADC0_P0 PTD1.
The ADC sampling result is always around 3v.
It is unclear why the order of the voltage values ​​read from the FIFO is exchanged, that is, the order of bandgap1.2v and 3v is exchanged. Give me some more time to check.

In the meantime, would you please refer to the: Example S32K344 PIT BTCU ADC DMA DS3.4 RTD100
That example save converted value by DMA.

1,426 Views
Ayaz
Contributor III
BR
Ayaz
0 Kudos
Reply
1,465 Views
Ayaz
Contributor III
i would appreciate it if you give me an answer asp.
0 Kudos
Reply