Question
Bug report Stm32cubeMX ADC initialization code( Cube v4.6.0/stm32f1xx_hal_adc.c(v1.0.0)
Posted on March 17, 2015 at 13:51
Hi,
I'm quite new to Stm32 development and tried cube for the first time last weekend,I'm using the STM32VLDISCOVERY board, (which by the way was not in the available list of predefined boards in Cube) (but selecting the MCU STM32F100RBTx it works)But, the bug that I found was when I tried to enable ScanConvMode to receive values from several ADC channels. But only the first (rank1) channel got converted.. And the reason to this was the mismatch between Cube generated ADC initialization value for enabling ScanConvMode, and the expected value in the driver..in the Cube generated adc.h hadc1.Init.ScanConvMode =ENABLE
;But in the driver it' expects the valueADC_SCAN_ENABLE
in HAL_ADC_Init: if (hadc->Init.ScanConvMode ==ADC_SCAN_ENABLE
) { tmp_sqr1 = ADC_SQR1_L_SHIFT(hadc->Init.NbrOfConversion); }And sinceADC_SCAN_ENABLE
!=ENABLE
The number of conversions is never read, and thus only the first channel in converted..Since it was the first time trying stm32 it took me half a weekend to realize that the fault was not in my code but in the generated.. =(/ChristerEdit: #adc-scanmode-stm32-stm32f1xx