lpc55s28 adc0_12 not working

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

lpc55s28 adc0_12 not working

Jump to solution
3,371 Views
PatrickLai
Contributor II

Hi,

I'm configuring ADC0_3 and ADC0_12 for LPC55S28. ADC0_3 can get different values for different input voltages, but ADC0_12 always gets 4092~4095 for any input voltages. Please help to check what is the possible cause of this issue. Attached my current changes for ADC

Best regards,

Patrick

0 Kudos
Reply
1 Solution
608 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @PatrickLai 

I'm sorry for the late reply. I’m not sure why our internal system didn’t send me a notification when you updated this thread.

Anyway, I have tested your project and checked the issue. The problem is that ADC0_12 corresponds to channel (ADCH) 4, not 12. So please change
#define DEMO_LPADC_USER_CHANNEL 12U
to
#define DEMO_LPADC_USER_CHANNEL 4U.

Also, please configure the sample channel mode to "Single-ended mode, as only the B-side channel is converted" . As shown below.

Alice_Yang_0-1768373641678.png

 

After these changes, it works correctly.

Alice_Yang_1-1768373677726.png

 

 

Hope it helps. 

Thank you.

 

BR

Alice

 

View solution in original post

0 Kudos
Reply
11 Replies
3,346 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @PatrickLai 

Please check your hardware to verify whether ADC0_12 is connected to a high voltage on the board. Also, please confirm that you are connected to the correct pin.
Thank you.
 
BR
Alice
0 Kudos
Reply
3,289 Views
PatrickLai
Contributor II
Hi Alice,
I've tested the input voltage of ADC0_12 pin on the MCU is 1.9V, so the hardware should be ok. but the adc value is still in range of 4091 and 4095
0 Kudos
Reply
3,275 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @PatrickLai 

 

Please connect GND for testing.
If the issue persists, use the configuration tool to set up the ADC and this channel.

 

BR

Alice

0 Kudos
Reply
1,291 Views
PatrickLai
Contributor II

Hi Alice,

I connected to ground and the adc value is still not right. I have trouble using config tool to setup adc. So I used the sample code lpadc_polling from the SDK. I only change the ADC channel to ADC0_12 and it still doesn't work. The ADC0_3 is ok. Could you please help to check based on the sample code and my configuration?

0 Kudos
Reply
1,112 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @PatrickLai 

Do you use the LPCXpresso55S28-EVK board? If yes, please check the schematic; this pin is connected to VDD.
Alice_Yang_0-1767602873934.png

 

BR

Alice

 

 
0 Kudos
Reply
1,109 Views
PatrickLai
Contributor II

Hi Alice,

I tested on the evk, and tried removing the R75 and press the USER button(SW3), adc value is still the same, around 4094~4095. Please help to check again.

Best regards,

Patrick

0 Kudos
Reply
1,106 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @PatrickLai 

Please share your complete project.
 
BR
Alice
0 Kudos
Reply
1,103 Views
PatrickLai
Contributor II

Hi Alice,

project code uploaded.

Best regards,

Patrick

0 Kudos
Reply
976 Views
PatrickLai
Contributor II
Hi @Alice_Yang ,
Any udpate?
Best regards,
Patrick
0 Kudos
Reply
609 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @PatrickLai 

I'm sorry for the late reply. I’m not sure why our internal system didn’t send me a notification when you updated this thread.

Anyway, I have tested your project and checked the issue. The problem is that ADC0_12 corresponds to channel (ADCH) 4, not 12. So please change
#define DEMO_LPADC_USER_CHANNEL 12U
to
#define DEMO_LPADC_USER_CHANNEL 4U.

Also, please configure the sample channel mode to "Single-ended mode, as only the B-side channel is converted" . As shown below.

Alice_Yang_0-1768373641678.png

 

After these changes, it works correctly.

Alice_Yang_1-1768373677726.png

 

 

Hope it helps. 

Thank you.

 

BR

Alice

 

0 Kudos
Reply
524 Views
PatrickLai
Contributor II

Hi Alice,

It works now. Thank you for your help.

Best regards,

Patrick

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2268403%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Elpc55s28%20adc0_12%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2268403%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI'm%20configuring%20ADC0_3%20and%26nbsp%3BADC0_12%20for%20LPC55S28.%20ADC0_3%20can%20get%20different%20values%20for%20different%20input%20voltages%2C%20but%26nbsp%3BADC0_12%20always%20gets%204092~4095%20for%20any%20input%20voltages.%20Please%20help%20to%20check%20what%20is%20the%20possible%20cause%20of%20this%20issue.%20Attached%20my%20current%20changes%20for%20ADC%3C%2FP%3E%3CP%3EBest%20regards%2C%3C%2FP%3E%3CP%3EPatrick%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2268552%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20lpc55s28%20adc0_12%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2268552%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F252433%22%20target%3D%22_blank%22%3E%40PatrickLai%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3EPlease%20check%20your%20hardware%20to%20verify%20whether%20ADC0_12%20is%20connected%20to%20a%20high%20voltage%20on%20the%20board.%20Also%2C%20please%20confirm%20that%20you%20are%20connected%20to%20the%20correct%20pin.%3C%2FDIV%3E%0A%3CDIV%3EThank%20you.%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3EBR%3C%2FDIV%3E%0A%3CDIV%3EAlice%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2269061%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20lpc55s28%20adc0_12%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2269061%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHi%20Alice%2C%3CBR%20%2F%3EI've%20tested%20the%20input%20voltage%20of%20ADC0_12%20pin%20on%20the%20MCU%20is%201.9V%2C%20so%20the%20hardware%20should%20be%20ok.%20but%20the%20adc%20value%20is%20still%20in%20range%20of%204091%20and%204095%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2269099%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20lpc55s28%20adc0_12%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2269099%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F252433%22%20target%3D%22_blank%22%3E%40PatrickLai%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CDIV%3EPlease%20connect%20GND%20for%20testing.%3C%2FDIV%3E%0A%3CDIV%3EIf%20the%20issue%20persists%2C%20use%20the%20configuration%20tool%20to%20set%20up%20the%20ADC%20and%20this%20channel.%3C%2FDIV%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EAlice%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2270768%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20lpc55s28%20adc0_12%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2270768%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Alice%2C%3C%2FP%3E%3CP%3EI%20connected%20to%20ground%20and%20the%20adc%20value%20is%20still%20not%20right.%20I%20have%20trouble%20using%20config%20tool%20to%20setup%20adc.%20So%20I%20used%20the%20sample%20code%20lpadc_polling%20from%20the%20SDK.%20I%20only%20change%20the%20ADC%20channel%20to%20ADC0_12%20and%20it%20still%20doesn't%20work.%20The%20ADC0_3%20is%20ok.%20Could%20you%20please%20help%20to%20check%20based%20on%20the%20sample%20code%20and%20my%20configuration%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2289079%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20lpc55s28%20adc0_12%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2289079%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F27788%22%20target%3D%22_blank%22%3E%40Alice_Yang%3C%2FA%3E%20%2C%3CBR%20%2F%3EAny%20udpate%3F%3CBR%20%2F%3EBest%20regards%2C%3CBR%20%2F%3EPatrick%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2292998%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20lpc55s28%20adc0_12%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2292998%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F252433%22%20target%3D%22_blank%22%3E%40PatrickLai%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3E%0A%3CP%3E%3CFONT%20face%3D%22times%20new%20roman%2Ctimes%22%20size%3D%224%22%3EI'm%20sorry%20for%20the%20late%20reply.%20I%E2%80%99m%20not%20sure%20why%20our%20internal%20system%20didn%E2%80%99t%20send%20me%20a%20notification%20when%20you%20updated%20this%20thread.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22times%20new%20roman%2Ctimes%22%20size%3D%224%22%3EAnyway%2C%20I%20have%20tested%20your%20project%20and%20checked%20the%20issue.%20The%20problem%20is%20that%20ADC0_12%20corresponds%20to%20channel%20(ADCH)%204%2C%20not%2012.%20So%20please%20change%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20face%3D%22times%20new%20roman%2Ctimes%22%20size%3D%224%22%3E%3CCODE%3E%23define%20DEMO_LPADC_USER_CHANNEL%2012U%3C%2FCODE%3E%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20face%3D%22times%20new%20roman%2Ctimes%22%20size%3D%224%22%3Eto%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20face%3D%22times%20new%20roman%2Ctimes%22%20size%3D%224%22%3E%3CCODE%3E%23define%20DEMO_LPADC_USER_CHANNEL%204U%3C%2FCODE%3E.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22times%20new%20roman%2Ctimes%22%20size%3D%224%22%3EAlso%2C%20please%20configure%20the%20sample%20channel%20mode%20to%20%22Single-ended%20mode%2C%20as%20only%20the%20B-side%20channel%20is%20converted%22%20.%20As%20shown%20below.%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Alice_Yang_0-1768373641678.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Alice_Yang_0-1768373641678.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Alice_Yang_0-1768373641678.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F372761i07EE9035DE62334B%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Alice_Yang_0-1768373641678.png%22%20alt%3D%22Alice_Yang_0-1768373641678.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CFONT%20face%3D%22times%20new%20roman%2Ctimes%22%20size%3D%224%22%3EAfter%20these%20changes%2C%20it%20works%20correctly.%3C%2FFONT%3E%3C%2FP%3E%0A%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Alice_Yang_1-1768373677726.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Alice_Yang_1-1768373677726.png%22%20style%3D%22width%3A%20148px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Alice_Yang_1-1768373677726.png%22%20style%3D%22width%3A%20148px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F372763i49A49526F646BA47%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Alice_Yang_1-1768373677726.png%22%20alt%3D%22Alice_Yang_1-1768373677726.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CBR%20%2F%3E%0A%3CBR%20%2F%3E%0A%3CP%3EHope%20it%20helps.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThank%20you.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EAlice%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2293885%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20lpc55s28%20adc0_12%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2293885%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Alice%2C%3C%2FP%3E%3CP%3EIt%20works%20now.%20Thank%20you%20for%20your%20help.%3C%2FP%3E%3CP%3EBest%20regards%2C%3C%2FP%3E%3CP%3EPatrick%3C%2FP%3E%3C%2FLINGO-BODY%3E