Hi,
Currently using the FRDM-KL25Z revE board on KDS3.0 platform using KSDK1.2.0 package.
Been trying the following adc programs:
1.Demo Examples:
a.adc_hw_trigger
b.adc_low_power
c.dac_adc_demo_frdmkl25z
2.Driver Examples
a.adc16
Unable to understand what channel adc is tied to. As in which PIN no.
For instance in adc_hw_trigger(lptmr):
#define ADC_INPUT_CHAN (kAdc16Chn23) /* default input signal channel */
Could some one please point out which pin.
For example: kAdc16Chn23 = PTB0(assuming)
In demo example "a.adc_hw_trigger(lptmr/pit)" how do i use the internal DAC to generate the sample signals onboard? How do i use the macro USE_DAC_OUT_AS_SOURCE in the code to activate the DAC feature to generate the wave?
Also could someone please provide a simple ADC code for the KL25Z using a Potentiometer as done here :Tutorial: ADC with the Freedom Board | MCU on Eclipse
Regards,
Nelson
Solved! Go to Solution.
Hi Nelson Lobo,
You don't need to add the dac_gen_wave function in your KL25 ADC hardware trigger sample code, because just like the KSDK1.2.0 Demo App User Guide section 2.2.4 said, although KL25 have the 12bit DAC, but this DAC output can't used as the ADC hardware trigger directly, if you want use the ADC hardware trigger, you need to use LPTMR, TPM, PIT ect.
You can find the ADC hardware trigger module in the KL25 reference manual:
DAC is not the hardware trigger source for ADC module in KL25 chip.
Wish it helps you!
If you still have question, please contact with me!
Hope it helps
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Nelson,
1) "kAdc16Chn23" is channel ADC0_SE23, the pin is PTE30 , you can find here ( kl25 reference manual):
2) you can #define USE_DAC_OUT_AS_SOURCE 1 , and in the FRDM-KL25 board demo , you can finde the function of dac_gen_wave()
in the "dac_gen_wave.c" file : ..\\Freescale\KSDK_1.2.0\examples\frdmkl25z\demo_apps\adc_hw_trigger .
3) About the tutorial , you can refer to it , and do you have some problem with it ?
Hope it helps
Have a great day,
Alice
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
"kAdc16Chn23" is channel ADC0_SE23 . How do i know this.I am using mk22fn512cap and cant make out how the kadc16chn1-31 " map to adc0_SEn or adc1_SEn.
Hi Alice,
As per your suggestions ive added the #define USE_DAC_AS_SOURCE 1 but had to introduce this statement in main.c, i tried introducing this statement in adc_hw_trigger.h as well as in dac_gen_wave.c but it wouldn't activate the #ifdef macros in main.c. Also i had to manually copy the dac_gen_wave.c file into the source directory of the project.
BTW as i was reading through the KSDK1.2.0 Demo App User Guide section 2.1.4 it states that DAC input signal for ADC channel is available for select Demo boards out of which FRDM-KL25Z wasn't listed. So jus wanted to clarify whether if the DAC feature is available or not ???
I was able to sample my signals on PTE30 as mentioned and got my expected signals plotted. This was done by providing the signals through another source.
Regards,
Nelson
Hi Nelson Lobo,
You don't need to add the dac_gen_wave function in your KL25 ADC hardware trigger sample code, because just like the KSDK1.2.0 Demo App User Guide section 2.2.4 said, although KL25 have the 12bit DAC, but this DAC output can't used as the ADC hardware trigger directly, if you want use the ADC hardware trigger, you need to use LPTMR, TPM, PIT ect.
You can find the ADC hardware trigger module in the KL25 reference manual:
DAC is not the hardware trigger source for ADC module in KL25 chip.
Wish it helps you!
If you still have question, please contact with me!
Hope it helps
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------