Please check if ADC example code is correct

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Please check if ADC example code is correct

跳至解决方案
1,014 次查看
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

标签 (3)
标记 (3)
0 项奖励
回复
1 解答
835 次查看
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 项奖励
回复
1 回复
836 次查看
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 项奖励
回复