AnsweredAssumed Answered

STM32-MAT/TARGET. Tons Of Bugs: ADC in STM32F0 and STM32F3 does not work

Question asked by Dima Sagalov on Feb 26, 2018


Windows10 (x64)

Matlab R2017a



STM32Cube MCU Package for STM32F0 Series -v1.9.0

STM32Cube MCU Package for STM32F3 Series -v1.9.0




For the STM32F0 microcontroller, the ADC_Read block completely ignores the ADC outputs assigned in Cube.

(see adc_stm32f0_vanilla)


The description of the ADC module for STM32F0 and STM32F4 differs significantly. In the ioc file, I supplemented the native description of the ADC STM32F0 with a description from the file for STM32F4 (see adc_stm32f0_semi_healed).

The outputs became visible:



But after code generation, they "fall off":



The code is generated successfully, but an error occurs during compilation:

«undefined reference to `hadc0'»

The problem with the "falling off" of the ADC outputs after the code generation occurs also for the STM32F3 series (see adc_stm32f3_vanilla). As a consequence - in the generated code, the input of the «CHAR convertion» block is replaced by 0.0 instead of the ADC output.

In addition, for both series there is a problem - the VREF channel is substituted for VBAT. It is necessary to specify the channel number in the ioc file directly - ADC_CHANNEL_17 instead of ADC_CHANNEL_VREFINT.