cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX bug: Wrong ADC resolution for STM32L476

Kamil Duljas
Senior III

Hi,

I notice that CubeMx allow choose 16-bit resolution but STM32L476 has range from 6 to 12 bit.


_legacyfs_online_stmicro_images_0693W00000bj2D5QAI.png 

When I generate code I can't compile it:


_legacyfs_online_stmicro_images_0693W00000bj2ESQAY.png
_legacyfs_online_stmicro_images_0693W00000bj283QAA.pngMoreover in datasheet we read on page 1:


_legacyfs_online_stmicro_images_0693W00000bj2EwQAI.png 

but it's only one information about mystic 16-bit resolution :D

Dudo
1 ACCEPTED SOLUTION

Accepted Solutions
6 REPLIES 6
Peter BENSCH
ST Employee

Well, we are talking about a 12-bit ADC with hardware oversampling.

In the generated code you will find at the very bottom: hadc1.Init.OversamplingMode = DISABLE;, which is set by the CubeMX setting in "ADC_Regular_ConversionMode". You will get 16bit oversampling when enabled.

Does it answer your question?

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

I don't think so. CubeMx should not generate code that you can't compile it​

Dudo

What does the ability to compile have to do with 16-bit oversampling?

Can't you compile the code?

Do you know how 16-bit oversampling works?

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Pleas look at my first post. CubeMx generate ADC_RESOLUTION_16B that not exist in ADC header for this board .

https://github.com/STMicroelectronics/STM32CubeL4/blob/e691a513a48d0014f201ce35a265cbfca446396d/Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_adc.h#L465

Dudo

Oh, sorry, I hadn't read the post carefully enough. You are right, the option ADC_RESOLUTION_16B must not appear or be selectable here.

Thank you for your contribution!

Regards

/Peter

@Sara BEN HADJ YAHYA​ 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Imen.D
ST Employee

Hello All,

Issue confirmed and an internal ticket (ID 150960) is submitted in order to fix this.

(PS: ID 150960 is an internal tracking number and is not accessible or usable by customers).

Thank you for your contribution.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen