AnsweredAssumed Answered

STM32F373Rxx ADC1 triggered by Timer4 CC? probable HAL library error

Question asked by Leonardo Volponi on Mar 23, 2017
Latest reply on Apr 3, 2017 by Imen D

The problem is a complier error because in the cube MX (version 4.20.0)
for the STM32F373R8Tx
using ADC1 (12 bits ADC) I can choose, in the configuration tab,

ADC1 and as external trigger source for regular conversion the TIM4 CC4 event....

this will generate this code:

hadc1.Instance = ADC1;
hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE;
hadc1.Init.ContinuousConvMode = DISABLE;
hadc1.Init.DiscontinuousConvMode = ENABLE;
hadc1.Init.NbrOfDiscConversion = 8;
hadc1.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_T4_CC4; <-- compiling this will generate an undefined error !
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc1.Init.NbrOfConversion = 8;

in the HAL libary header (version 1.7.0 lates up to date) stm32f3xx_hal_adc_ex.h

at the line 1349 there is: #define ADC_EXTERNALTRIGCONV_T4_CC2 ADC_EXTERNALTRIG_T4_CC2

at the line 1827 there is: #define ADC_EXTERNALTRIG_T4_CC2 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0))


Reading at the manual STM32F37xx Reference Manual (RM0313) in the chapter 12.12.3 ADC control register 2 (ADC_CR2) the documentation report:

EXTSEL[2:0] External event selector for regular group:

the value (bits) 101 that is (ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0)

the manual reports that with this configuration the trigger source should be TIM4 CC4 Event.



is there anybody that can explain this ?

Thank you very much in advance for your help !


Best regards