cancel
Showing results for 
Search instead for 
Did you mean: 

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

Dima Sagalov
Associate II
Posted on February 26, 2018 at 04:24

Environment:

Windows10 (x64)

Matlab R2017a

STM32-MAT/TARGET-v4.4.2

STM32CubeMX-v4.24.0

STM32Cube MCU Package for STM32F0 Series -v1.9.0

STM32Cube MCU Package for STM32F3 Series -v1.9.0

SW4STM32-v2.4

TrueSTUDIO-v9.0.0

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

(see adc_stm32f0_vanilla)

0690X00000609pCQAQ.png

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:

0690X00000609icQAA.png

But after code generation, they ''fall off'':

0690X00000609oxQAA.png

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.

#stm32-mat/target-matlab #simulink
0 REPLIES 0