Question
Trigger ADC1 scan using TIM1 CC1 on F410RB
Posted on September 20, 2016 at 13:08
Hi,
I use STM32F410RB, and I need to trigger an ADC1 scan regular conversion every TIM1 CC1 event. I am sure that TIM1 works, because I have an interrupt that is triggered every CC1 event. I tried to configure ADC as follows:
ADC_ChannelConfTypeDef sConfig;
/* ADC Initialization */
AdcHandle.Instance = ADC1;
AdcHandle.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4;
AdcHandle.Init.Resolution = ADC_RESOLUTION_12B;
AdcHandle.Init.ScanConvMode = ENABLE;
AdcHandle.Init.ContinuousConvMode = DISABLE;
AdcHandle.Init.DiscontinuousConvMode = DISABLE;
AdcHandle.Init.NbrOfDiscConversion = 0;
AdcHandle.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING;
AdcHandle.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_T1_CC1;
AdcHandle.Init.DataAlign = ADC_DATAALIGN_RIGHT;
AdcHandle.Init.NbrOfConversion = 2;
AdcHandle.Init.DMAContinuousRequests = DISABLE;
AdcHandle.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
HAL_ADC_Init(&AdcHandle);
/* Configure ADC3 regular channel */
sConfig.Channel = ADC_CHANNEL_0;
sConfig.Rank = 1;
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
sConfig.Offset = 0;
HAL_ADC_ConfigChannel(&AdcHandle, &sConfig);
/* Configure ADC3 regular channel */
sConfig.Channel = ADC_CHANNEL_1;
sConfig.Rank = 2;
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
sConfig.Offset = 0;
HAL_ADC_ConfigChannel(&AdcHandle, &sConfig);
HAL_ADC_Start_IT(&AdcHandle); But ADC no interrupt is triggered. Which register, which bit are involved in the configuration? best regards Max #adc #timer #stm32f410rb
Note: this post was migrated and contained many threaded conversations, some content may be missing.