read adc value problem

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

read adc value problem

Jump to solution
1,178 Views
darkblue
Contributor I

I use adc0_dp0 to read value in KW36 sdk, and I got voltage like 1 or 0. Can I just init adc0_dp0 as single mode?

0 Kudos
Reply
1 Solution
932 Views
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @darkblue ,

In this case, we can only choose single-ended mode. Please refer to the Reference Manual [Link] ,  chapter 4.8.2.3.1 ADC0 Channel Assignment listed all options.

Gavin_Jia_0-1695105661349.png

 

Best regards,

Gavin

View solution in original post

0 Kudos
Reply
7 Replies
1,161 Views
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @darkblue ,

You are correct. 

When the channel is selected as a Single-Ended Input, the positive input (ADC0_DP0) is the selected input signal. 

 

Best regards,

Gavin

0 Kudos
Reply
1,157 Views
darkblue
Contributor I

thanks for replying.  When I enabled diff mode and used adc0_dm0 to measure voltage, I found that the value was incorrect.  The actual voltage is 1.09v, but it reads 64189. It seems like already over range.  how can I fix that ?

0 Kudos
Reply
1,076 Views
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @darkblue ,

 

Please check the result value in the code, which cannot be defined as the uint type, because there will be a result of less than 0 when using diff mode.

 

Gavin

0 Kudos
Reply
1,070 Views
darkblue
Contributor I

thanks. I understand the minus number in diff mode. But actually, I want to use the single end mode

I can't find how to make adc0_dm0 working in single mode in MKW36A512RM.  That means adc0_dm0 can be only configured in diff mode in mkw36a512? 

0 Kudos
Reply
991 Views
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @darkblue ,

 

Sorry for my late reply.

I got your point now. If you configure ADC to the single-end mode, you only need to consider dp which should connect input signal. dm connected to GND internally, no additional configuration required, and it can be ignored.

 

Best regards,

Gavin

0 Kudos
Reply
982 Views
darkblue
Contributor I

Thanks for reply. Due to project design I can only use dm to measure voltage  instead of dp. Which means I have to connect dm to input signal. meanwhile the dp may be 0 or 1 or float. Does that work? In this situation the dp can be ignored?

0 Kudos
Reply
933 Views
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @darkblue ,

In this case, we can only choose single-ended mode. Please refer to the Reference Manual [Link] ,  chapter 4.8.2.3.1 ADC0 Channel Assignment listed all options.

Gavin_Jia_0-1695105661349.png

 

Best regards,

Gavin

0 Kudos
Reply