Please check if ADC example code is correct

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

Please check if ADC example code is correct

Jump to solution
778 Views
jeremyhsiao
Contributor II

Hi,

My MCU is LPC11U68 and using LPCExpresso board rev c.

In periph_adc.c, there is a line:

    /* ADC input 0 is on PIO0_12 mapped to FUNC2 */

   Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 9, (IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_ADMODE_EN));

(1) For LPC11U68, ADC input 0 should be PIO1_9, so the comment description is wrong.

(2) If using PIO1_9, the example code seems incorrect (IOCON_FUNC3 instead of IOCON_FUNC1) and it should be:

   /* ADC input 0 is on PIO1_9 mapped to FUNC3 */
   Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 9, (IOCON_FUNC3 | IOCON_MODE_INACT | IOCON_ADMODE_EN));

Please help to check. Thank you.

Jeremy

Labels (3)
Tags (3)
0 Kudos
1 Solution
599 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Jeremy,

    Yes, you are right, it is the lpcopen code bug.

1. ADC input 0 is PIO1_9, and the Func is Func3.

pastedImage_1.png

2. You are right, you need to use Func3, it is the code bug.

This type bug I have reported to our according department, but it is not fixed now.

You can modify it by yourself now.

A similar post also for your reference:

Errors in "periph_adc" example for LPC11U68 

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
1 Reply
600 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Jeremy,

    Yes, you are right, it is the lpcopen code bug.

1. ADC input 0 is PIO1_9, and the Func is Func3.

pastedImage_1.png

2. You are right, you need to use Func3, it is the code bug.

This type bug I have reported to our according department, but it is not fixed now.

You can modify it by yourself now.

A similar post also for your reference:

Errors in "periph_adc" example for LPC11U68 

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos