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 件の賞賛
返信