S32k311 ADC module for MCAL

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32k311 ADC module for MCAL

1,683件の閲覧回数
dhanabharathi
Contributor III

Hello @nxp 

  i am configuring ADC module for S32k31xevb- q100. i am using Autosar based MCAL layer configuration. in my case i am using software trigger without Interrupt method.  it is entering in to this function but my ADc value is not converting Adc_Sar_Ip_StartConversion(PhysicalHwUnitId, ADC_SAR_IP_CONV_CH AIN_NORMAL); what will be reason for this?

タグ(3)
0 件の賞賛
返信
14 返答(返信)

1,619件の閲覧回数
dhanabharathi
Contributor III

hi @Senlent 
ok, Thankyou.
Another one problem.
when read data via analog pin. the VREF is always it taking 2.5 v only. I need 3.3v or 5v Vref. where i need to configure this? i can't set the Vref voltage. the configuration setting is inactive. i attached image for your reference

0 件の賞賛
返信

1,602件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@dhanabharathi

I'm not sure what you mean. Shouldn't VREF be fixed? I

sn't it determined during hardware design?

If I'm misunderstanding your question, please let me know.

0 件の賞賛
返信

1,595件の閲覧回数
dhanabharathi
Contributor III

Hi @Senlent ,
 
   I will explain clearly My ADC reading seems to be calculated using the internal 2.5 V reference, but my input uses a 3.3 V reference (potentiometer on 5 V). How do I change the ADC reference from 2.5 V to 5 V so that the calculation V_measured = (ADC_value / (2^n − 1)) × Vref uses 5V?

タグ(3)
0 件の賞賛
返信

1,562件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@dhanabharath

"My ADC reading seems to be calculated using the internal 2.5 V reference"

Unless there is a problem with your VREFH pins, this is not possible

 

The ADC reference voltage VREF cannot be modified via software.

This is related to your current external voltage selections for VREFH and VREFL pins.

If you are referring to how to modify the external ADC reference voltage in hardware, then you

need to review your hardware design and modify it.

0 件の賞賛
返信

1,555件の閲覧回数
dhanabharathi
Contributor III

hello @Senlent 

   ok. i understood.

I verified that VREFH is 5.0 V. However, when I feed 4.0 V into the ADC, the conversion result is off from the expected value for a 5 V reference. Could you help me review potential causes (reference selection, calibration, sampling time, or pin routing)?

タグ(3)
0 件の賞賛
返信

1,553件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@dhanabharathi

Share your whole project and i will take time to test it.

0 件の賞賛
返信

1,532件の閲覧回数
dhanabharathi
Contributor III

Hi @Senlent ,

  i have attached the project file.

タグ(3)
0 件の賞賛
返信

1,456件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@dhanabharathi

I see no problem with your configuration, but some mistake in your code.

Issues 1.

#define ADC_BANDGAP 5980U /* Vbandgap ~ 1.2V on 14 bits resolution, 3.3V VrefH */

#else

#define ADC_BANDGAP 3932U /* Vbandgap ~ 1.2V on 14 bits resolution, 5V VrefH */

#endif

 

if your VREF is 5V , then the ADC_BANDGAP is 3932, not 5980.

 

Issues 2.

if ((ResultBufferDma[0u] >> 1U != AdcReadGroupResult[0u]) || \
(ResultBufferDma[1u] >> 1U != AdcReadGroupResult[1u]) || \
(ResultBufferDma[2u] != RESULT_BUFF_VAL) || \
(AdcReadGroupResult[2u] != ADC_RESULT_BUFF_VAL) || \
(ADC_TOLERANCE((ResultBufferDma[0u] >> 1U), ADC_BANDGAP)) || \
(ADC_TOLERANCE((ResultBufferDma[1u] >> 1U), ADC_VREFH)) \
)

You should delete these two lines of code. The original demo only set up two sampling channels, but you are currently using 4 sampling channels. This judgment will cause you to be unable to perform the next sampling.

 

 

0 件の賞賛
返信

1,327件の閲覧回数
dhanabharathi
Contributor III

Hello @Senlent 

  I followed your steps , still the same problem persists

タグ(3)
0 件の賞賛
返信

1,273件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@dhanabharathi

The test hardware base on S32K31XEVB, and the result is right on myside.

I attached the project and the test result for your reference.

2025-10-23_13-35-45.png

0 件の賞賛
返信

1,266件の閲覧回数
dhanabharathi
Contributor III
hello @Senlent,

I will check my side again and i will let you know
0 件の賞賛
返信

1,569件の閲覧回数
dhanabharathi
Contributor III

Hi @Senlent ,

   No, i didn't get your point.

タグ(3)
0 件の賞賛
返信

1,589件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@dhanabharathi

vrefh and vrefl are the high and low reference voltage points of the ADC, corresponding to the vrefh and vrefl pins of the pins

Senlent_0-1760598697496.png

Can you understand my explanation?

 

 

 

 

 

0 件の賞賛
返信

1,646件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@dhanabharathi

You didn't add and configurate "Rm" component in your project.

Senlent_0-1760348275804.png

 

0 件の賞賛
返信