2017-11-17 04:07 AM
Hello,
i am working on a 3phase bldc solution using TIMER1 using a STM32F427VI device
The hardware is providing 3 ADC channels ( one for each phase), and 1 ADC channel which measures the DC voltage of the converter
For the current adc channels, i was thinking to use the adc regular channels with trigger source from Timer1 via the ADC_ExternalTrigConv_T1_CC1/2/3
And for the DC voltage to use a adc injected channel triggered by timer1 cc4 event.
My adc setup code looks like this
ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div2; ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles; ADC_CommonInit(&ADC_CommonInitStructure);ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStructure.ADC_ScanConvMode = DISABLE; ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; // ADCx->CR2 CONT bit = 0 (1 only for regular channels) ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1; // Trigered by Timer1 - Channel 1 ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_Rising; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfConversion = 1; ADC_Init(ADC1, &ADC_InitStructure); ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_3Cycles); // regular channel 1 /* ---------- Injected settings only -------------- */ ADC_InjectedSequencerLengthConfig(ADC1, 2);// Set injected sequencer length ADC_InjectedChannelConfig(ADC1, ADC_Channel_12, 1, ADC_SampleTime_3Cycles); // injected channel 1 ADC_ExternalTrigInjectedConvConfig(ADC1, ADC_ExternalTrigInjecConv_T1_TRGO); ADC_ExternalTrigInjectedConvEdgeConfig(ADC1,ADC_ExternalTrigInjecConvEdge_Rising); ADC_ITConfig(ADC1, ADC_IT_EOC, ENABLE); // Enable regular end of conversion interrupt ADC_ITConfig(ADC1, ADC_IT_JEOC, ENABLE);// Enable injected end of conversion interrupt ADC_Cmd(ADC1, ENABLE);I was wondering if it is posible to specify a diferent trigger source for each of the regular channels on the same ADC module?
For example regular channel1 to be triggered by TIM1-CC1, regular channel2 to be triggred by TIM1-CC2 and channel 3 triggered by TIM1-CC3 ? Or for this kind of setup i need to use 3 ADC modules?