![]() |
Kinetis SDK v.1.2 Demo Applications User's Guide
Rev. 0
Freescale Semiconductor, Inc.
|
This demo application demonstrates how to use the ADC driver with various hardware triggers.
This is an ADC demo application which shows how to use different hardware trigger sources to handle the ADC hardware trigger function. These trigger sources are supported:
The Periodic Interrupt Timer (PIT) is a period timer source and the ADC hardware trigger event. Because the PIT trigger event can only be used to trigger one of the ADC channels (mux A or B), this demo uses PIT as a trigger source for the ADCx channel 0. The PIT triggers the ADC in a fixed frequency and the demo gets the ADC conversion result in the ADC Conversion Complete (COCO) interrupt. TWR-KV10Z32 does not support PIT trigger, due to no PIT in KV10 silicon.
The Programmable Delay Block (PDB) is a continuous trigger event for ADC. It uses the software trigger as the first trigger input event and turns on the PDB continuous mode to generate a period trigger source. Because the PDB can trigger different channels inside one ADC instance, this demo shows the Ping-Pong triggering which occurs by sampling the channel 0/1 with the PDB Pre-trigger A/B channel. FRDM-KL26Z and MRB-KW01 does not support PDB trigger, because PDB is not present neither on KL26 nor on KW01 silicon.
The Low Power Timer (LPTMR) is a period timer source and the ADC hardware trigger event. Because the LPTMR trigger event can only be used to trigger one of the ADC channels (channel 0 or 1), this demo uses the LPTMR as a trigger source for the ADCx channel 0. The LPTMR triggers the ADC in a fixed frequency and the demo gets the ADC conversion result in the ADC Conversion Complete (COCO) interrupt.
Use the DAC module to generate a sine wave as the ADC input on the DAC0_OUT pin. Normally, the DAC0_OUT is internally connected to the ADC0_SE23 (DAC0_OUT is a source of ADC0_SE23), there is no need to connect any external signals for this demo.
Boards listed below need external sine wave connected either because of lack of the DAC hardware feature support or lack of the SoC/Board signal connection support.
This demo samples the input digital signal from the ADC0_SE23 pin and records each sample point with the appropriate amplitude. After 2 period samples are complete, it prints out the rough shape of the signal wave on the debug console like a primitive oscilloscope.
These Freescale Freedom development platforms and Tower System modules are supported by the KSDK ADC Hardware Trigger demo.
The adc_lptmr_trigger demo Supported Platforms:
The adc_pdb_trigger demo Supported Platforms:
The adc_pit_trigger demo Supported Platforms:
The adc_tpm_trigger demo Supported Platforms:
For the MRB-KW01: It is necessary to short jumpers J10 and J11 to connect the ADC references. If the ADCO_SE23 or internal DAC connection is used it is necessary to disconnect J7 to open PTE30 connection with the RESET of the RADIO part. Also analog function for PTE30 - DAC output is necessary on the mrb-kw01 (default is GPIO for RADIO part reset).
For more detailed instructions, see a Kinetis SDK User's Guide for your board.
This demo application is customizable to show different kinds of input signal waves.
The configuration macro is located in the adc_hw_trigger.h header file.
The default sample rate is 1000 Hertz, which enables the demo application to get 100 samples per two periods. To change the sample rate, see the next section.
Printing of the signal wave shape depends on the console size. A console can be 100x40. To get the best printing effect, align the number of samples to the console column numbers and convert the amplitude range to the [0, row - 1] range. The console column number should be same as sample numbers. Configuring the number of samples means configuring the console column size:
Change the following macro to configure the desired frequency in Hz units.
Change the ADC_INST macro to configure the ADC instance you want to use.
If you do not use the DAC0_OUT as a input signal, disable the macro in the project:
After disabling the DAC output, configure one ADC input source pin to get the signal: