ADC configuration in BSP

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

ADC configuration in BSP

Jump to solution
795 Views
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 Kudos
1 Solution
426 Views
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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
1 Reply
427 Views
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 Kudos