Issue with Reading 12-bit ADC Values on S32K312

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

Issue with Reading 12-bit ADC Values on S32K312

Jump to solution
1,402 Views
selvarajasekar
Contributor III

I am using S32 Design Studio 3.4 along with example projects from S32K3 RTD AUTOSAR 4.4.2.0.0 D2203. Specifically, I am working with the Adc_sar_Bctu_ip_example_s32k312 project.

I have configured the ADC channels, but I am encountering an issue where the ADC value ranges from 0 to 227 (min to max). I need the ADC value to range from 0 to 4096, which corresponds to the full 12-bit resolution.

I have attempted to change the configuration settings, but the problem persists. I will attach the configuration I have done in S32 Design Studio.

Could you please assist me in resolving this issue? I look forward to your prompt response.

I have attached the platform_io.c ,kindly check the line from 1026 to 1078.(ADC PART).
1.png2.png3.png4.png5.png6.png7.png

0 Kudos
Reply
1 Solution
1,297 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you have some divider on inputs, so you do not get full scale assuming Vref is at 5V too.
However as I wrote, an issue could be you did not perform ADC calibration before conversion. Check behavior when you do it.
If have issue still, share simplified project so we can test on EVB, or refer to RTD demo example.

BR, Petr

View solution in original post

0 Kudos
Reply
6 Replies
1,358 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

the setting looks normal. For a code you would perform ADC calibration (Adc_Sar_Ip_DoCalibration) after ADC init and before conversion is initialized.
What do you have connected to precise channels, which are selected to be converted using normal chain? How are MCU pins configured?
Is a BCTU conversion also triggered? And what is a result from that?

BR, Petr

0 Kudos
Reply
1,340 Views
selvarajasekar
Contributor III

Hi,
I'm seeking a straightforward method to obtain a 12-bit ADC reading from the ADC pin, with the  BCTU conversion has been triggered in my code. I've provided a code reference and an image detailing the MCU pin configuration for your convenience.

0 Kudos
Reply
1,326 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

please specify measured voltage on ADC_INx pins and obtained values in ADC_Result buffer.

BR, Petr

0 Kudos
Reply
1,319 Views
selvarajasekar
Contributor III

Hi Petrs,
The measured voltage at ADC_IN5, ADC_IN6, and ADC_IN7 is 5 volts, and the values in the ADC_Result buffer range from a minimum of 27 to a maximum of 168.

0 Kudos
Reply
1,298 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you have some divider on inputs, so you do not get full scale assuming Vref is at 5V too.
However as I wrote, an issue could be you did not perform ADC calibration before conversion. Check behavior when you do it.
If have issue still, share simplified project so we can test on EVB, or refer to RTD demo example.

BR, Petr

0 Kudos
Reply
1,123 Views
selvarajasekar
Contributor III
driver is not updating, we need to change the resolution manually
0 Kudos
Reply