ADC configuration in BSP

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

ADC configuration in BSP

跳至解决方案
828 次查看
tuowang
Contributor II

I am writing MQX application code for Kinetis MCU MK64FN1M0VLL12 of a custom board. My question is regarding ADC configuration in BSP.

I would like to use pin 14 (ADC0_DP1) and pin 15(ADC0_DM1) as two singled ended ADC inputs instead of differential ADC (which is by default). How to configure BSP projects to make this work? The BSP projects I am using are ported from FRDM-K64F BSPs and All ADC related configuration are as default.

I noticed that in (costomboard).h file under bsp project directory, there are macros defining ADC input and ADC source mapping. What ADC source should I use if I want to configure those two pins are two single-

ended ADC inputs? Is there any other places in BSP projects or application code (My plan is to use LWADC APIs) that I need to modify to make this work?

Thank you very much!

Tuo

0 项奖励
1 解答
459 次查看
RadekS
NXP Employee
NXP Employee

Unfortunately MQX 4.1.1 doesn’t contain directly FRDMK64F project for LWADC example code.

However you can take LWADC projects for other boards as inspiration.

You can modify frdmk64f.h file or rather user_config.h file where you define your BSP ADC channels as for example:

#define BSP_ADC_INPUT_0          (ADC0_SOURCE_AD1)  //pin14 for 100 LQFP package

#define BSP_ADC_INPUT_1          (ADC0_SOURCE_AD20)  //pin15 for 100 LQFP package

See chapter “3.7.1.3.1.3 ADC0 Channel Assignment for 100-Pin Package” in reference manual:

http://www.freescale.com/files/microcontrollers/doc/ref_manual/K64P144M120SF5RM.pdf

ADC0_SOURCE_AD1 refers to ADC0_DP1 with SC1n[DIFF]= 0.


Have a great day,
RadekS

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

在原帖中查看解决方案

0 项奖励
1 回复
460 次查看
RadekS
NXP Employee
NXP Employee

Unfortunately MQX 4.1.1 doesn’t contain directly FRDMK64F project for LWADC example code.

However you can take LWADC projects for other boards as inspiration.

You can modify frdmk64f.h file or rather user_config.h file where you define your BSP ADC channels as for example:

#define BSP_ADC_INPUT_0          (ADC0_SOURCE_AD1)  //pin14 for 100 LQFP package

#define BSP_ADC_INPUT_1          (ADC0_SOURCE_AD20)  //pin15 for 100 LQFP package

See chapter “3.7.1.3.1.3 ADC0 Channel Assignment for 100-Pin Package” in reference manual:

http://www.freescale.com/files/microcontrollers/doc/ref_manual/K64P144M120SF5RM.pdf

ADC0_SOURCE_AD1 refers to ADC0_DP1 with SC1n[DIFF]= 0.


Have a great day,
RadekS

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

0 项奖励