Hi,
I am using a K60 TWR system and want to setup a timer that triggers with a certain period the ADC1 converter (used by the onboard potentiometer). So I setup the Trigger of the ADC as follows:
Trigger: enabled
Trigger signal list: 1
Trigger signal 0: Enabled
Trigger input: Flex_timer_0
Trigger type: internal
Source component: TU1 (thats the name of my timer)
Trigger activate state: Rising edge
The FMT0 is configured as:
Component name: TU1
Module name: FTM0
Counter: FTM0_CNT
Counter direction: Up
Counter frequency: 256Hz
Period: 1sec
My source code looks like:
ADC1_Data = AD1_Init(NULL);
SampleGroup[0].ChannelIdx = 0U;
Error = AD1_CreateSampleGroup(ADC1_Data, (LDD_ADC_TSample *)SampleGroup, SAMPLE_GROUP_SIZE);
Error = AD1_StartLoopTriggeredMeasurement(ADC1_Data);
So I thought the ADC should convert every second. However it does not - what did I wrong?
BTW - how can I synchronize a PDB Block to an overrun/restart of a FMT.
Best Regards
Markus
Solved! Go to Solution.
Hello,
I think that I have answered your first question within this thread:
https://community.freescale.com/thread/117612
You must additionaly write to the EXTTRIG register in user code.
best regards
Vojtech Filip
Processor Expert Support Team
Hello,
I think that I have answered your first question within this thread:
https://community.freescale.com/thread/117612
You must additionaly write to the EXTTRIG register in user code.
best regards
Vojtech Filip
Processor Expert Support Team
Hi,
I found a solution to use the FMT to trigger an ADC. Attached you find a example project that works on the K60F120 TWR Board. The example uses the ADC_LDD and Init_FMT components. I used them because the ADC_LDD gives you access to the different methods and Init_FMT allows you to setup a FMT modul to generate the hardware triggers.
What is interesting to note:
The ADC that is triggered by a FMT can only convert 1 channel. I tried to setup another to add another ADC_LDD for the same ADC converter - this experiment fails. So you can just convert one channel of an ADC by a FMT component.
Using a PDB is a little bit better because you can setup two triggers for one ADC converter. However does one have an idea what to do to convert more then two channels triggered by a onchip component?
Best Regards
Markus
Hi,
Regarding the triggering with FTM - yes, this is a limitation of the hardware, on K60 only one trigger from FTM is available.
For two triggers, the PDB can be used.
If you need more channels than 2 to be measured, you need to change the channel after each conversion within the OnMeasurementComplete event code (using SelectSampleGroup method, see the Typical usage help page for the ADC_LDD component).
Another possibility would be to use DMA for both configuring the channel and reading the result. However this is not a technique supported by the ADC_LDD component and the code is highly platform specific for the K60. I attach an example measuring multiple channels using PEx peripheral initialization components.
best regards
Petr Hradsky
Processor Expert Support Team