AnsweredAssumed Answered

STMCubeMX: Incorrect ADC generation for STM32103CBT6

Question asked by IvoM on Feb 17, 2015
Latest reply on Mar 18, 2015 by STM32Cube-T
When creating a project for the STM32103CBT6 where ADC1 is configured with 'Scan Conversion Mode' set to 'Enable' the code is generated incorrectly in MX_ADC1_INIT (adc.c).

The generated code shows:
  hadc1.Init.ScanConvMode = ENABLE;
where ENABLE  is defined as (!DISABLE) and DISABLE as 0

This should be:
  hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE;
where ADC_SCAN_ENABLE is defined as ADC_CR1_SCAN which is defined as ((uint32_t)0x00000100)

Also note that the ASSERT will be triggered with this generated code:
assert_param(IS_ADC_SCAN_MODE(hadc->Init.ScanConvMode));

STM32CubeMX v4.6.0 is used with STM32CubeF1 v1.0.0

Outcomes