cancel
Showing results for 
Search instead for 
Did you mean: 

ADC Trigger TIM8

bmwael1
Associate II
Posted on April 02, 2013 at 13:03

Hi,

I create a TIM8 mode up and down using this Instruction

TIM_TimeBaseStructure.TIM_Period = 2000;
TIM_TimeBaseStructure.TIM_Prescaler = PrescalerValue;
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_CenterAligned3;
 TIM_TimeBaseInit(TIM8, &TIM_TimeBaseStructure);

0690X00000602l9QAA.jpg Then I create a PWM signal using TIM8_CH1

TIM8->CCR1 = 1500 ; 
// PC6 Signal 1

I have another part of my program that read ADC value of 5 signal using DMA. I want to trigger the reading of ADC 4 time in period (The red circled in figure) Ie when TIM8 = 0 , TIM8 = 1500 Up, TIM8 = 1500 Down, TIM8 = 2000, ... I use this line in ADC configuration

ADC_InitStructure.ADC_ScanConvMode = ENABLE;
 ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
 ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_RisingFalling; 
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T8_CC1;

But i don't know what this 2 line do exactly :\ And how to verify if The trigger works in the desired Time or no ? Can someone help me to read ADC in this 4 time Thanks :)
2 REPLIES 2
bmwael1
Associate II
Posted on April 03, 2013 at 13:33

I'm using STM32F4 and i want to impose the convertion in a specific time when Timer = 0, 1500up, 2000, and 1500down, and repeat this ..

Posted on April 03, 2013 at 15:17

I don't see a simple way to achieve what you want. But you might perhaps use two ADCs, the first triggered from the output waveform as you do now, and the other triggered from TRGO of the same timer, with MMS being set to 010 (i.e. an edge on TRGO at every update event, which in case of centered counter should be both at 0 and at the reload).

Alternatively, instead of using two ADCs, the two triggers (regular and injected) of the same ADC could be used, if appropriate CC channel is chosen.

This is just an idea, you have to try yourself.

JW