Using NMI as ADC

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Using NMI as ADC

1,439件の閲覧回数
asapuntz
Contributor I

KE18F 64-pin package

Per RM 34.2.2 Pin Properties, 45/D3 defaults to NMI with pull-up after POR.

It can also function as BOOTCFG0 as well as ADC1_SE3 (among others)

Setting FOPT[NMI_DIS] = 0 should disable NMI interrupts.

I assume I still need to change PORTD_PCR3[MUX] = 0 to select the ADC function.

Should I do anything with PORTD_PCR3[PE]?

I don't want the pull-up interfering with the SAR ADC input filter.

However, I also don't want to risk booting from ROM (BOOTCFG0 low) for reset types other than POR.

Per 35.6.1, "Pull configuration is valid in all digital pin muxing modes". Does that mean it should be disabled for ALT0/analog, or is it irrelevant? Figure 35-1 suggests that it is relevant, but that may be a simplification.

Note: I plan to set FOPT[BOOTPIN_OPT] = 1 and FOPT[BOOTSRC_SEL] = 01 to avoid the BootROM.

Edit: upon closer inspection, it seems that Fig 35-1 shows the pull-up/down portion is disconnected for ALT0/analog MUX setting

0 件の賞賛
返信
3 返答(返信)

1,419件の閲覧回数
asapuntz
Contributor I

The focus of my question isn't how to do things, it's whether it's better to leave PE  = 1 when MUX = 0 for this particular pin.

My concern is that any reset will revert the pin to NMI and BOOTCFG0 functionality (MUX = 7). But only POR will re-enable the pull-up if software sets PE = 0.

Without the pull-up, the state of the pin will be unpredictable, possibly dependent on the external SAR filter capacitor.

FOPT can be used to disable both NMI and BOOTCFG0 functionality, but if BOOTCFG0 is still needed to select between Flash and ROM, the pull-up needs to be active during the boot selection process.

The pull-up should not be enabled once software changes MUX = 0. It looks like this will be achieved even if software leaves PE = 1, because the little mux at the top of RM Fig 35-1 would disable it regardless of the PE setting.

Am I understanding things correctly?

0 件の賞賛
返信

1,409件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi asapuntz,

   When your select the pin mux as the analog, the pull up and pull down circuit will be disconnect.

   So, if you want to use it as the analog pin, you just need to set MUX=0, and configure the ADC modules.

   The PE=1 is used for the digitial pin function.

   When you disable the NMI pin function, then set the NMI pin as the MUX=0 your NMI pin is the analog pin now.

   Your understanding is correct!

 

Wish it helps you!

If you still have questions about it, please kindly let me know!

Best Regards,

Kerry

-------------------------------------------------------------------------------

Note:

- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored

Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

-----------------------------------------------------------------------------

 

0 件の賞賛
返信

1,427件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi asapuntz,

   1. If you don't want to use the NMI, you can disable it by FOPT[NMI_DIS] = 0

    2. You need to PORTD_PCR3[MUX] = 0 PORTD_PCR3[PE]=0, for the ADC function.

    3. I think the analog mode 0 , you can disable the pull configuration if you really don't want to use it.

    4.  set FOPT[BOOTPIN_OPT] = 1 and FOPT[BOOTSRC_SEL] = 01 is OK

 

 

Wish it helps you!

If you still have questions about it, please kindly let me know!

Best Regards,

Kerry

-------------------------------------------------------------------------------

Note:

- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored

Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

-----------------------------------------------------------------------------

0 件の賞賛
返信