AnsweredAssumed Answered

Fix for STM32F0xx StdPeriph Lib

Question asked by Oliver on Jul 21, 2014
Latest reply on Jan 26, 2015 by Montassar BEN ROMDHANE

I just ran into a trap with STM32F0xx_StdPeriph_Lib_V1.3.1 and have a suggestion for a fix.

In function ADC_ChannelConfig() of file stm32f0xx_adc.c, the line 724

ADCx->CHSELR |= (uint32_t)ADC_Channel;

activates the selected channel. Previously selected channels remain selected. In my opinion this behaviour is misleading, also considering the function documentation header. Furthermore there is no function to de-select the previously selected channels, so I have to break with hardware abstraction in my code and clear CHSEL manually.

My suggestion is to change line 724 to

ADCx->CHSELR = (uint32_t)ADC_Channel;

which actually configures the selection passed by parameter without having a "memory effect".

This is already changed in Cube FW, so it would also be consistent with it.