AnsweredAssumed Answered

STM32F0xx_StdPeriphDriver Comparator Speed Setting

Question asked by Oliver on Jul 2, 2013

there is a bug in stm32f0xx_comp.h (V1.0.0RC1 / 27-January-2012), which I recently downloaded from the ST website. The comparator speed settings begin with low speed modes, but according to the reference manual (14.4.1 COMP control and status register / p. 227), the high speed ones come first (I can confirm, this is correct).

The code is:

#define COMP_Mode_UltraLowPower                  0x00000000           /*!< Ultra-low power mode */
#define COMP_Mode_LowPower                       COMP_CSR_COMP1MODE_0 /*!< Low power mode */
#define COMP_Mode_MediumSpeed                    COMP_CSR_COMP1MODE_1 /*!< Medium Speed */
#define COMP_Mode_HighSpeed                      COMP_CSR_COMP1MODE   /*!< High Speed */

But should be:

#define COMP_Mode_HighSpeed                  0x00000000           /*!< High Speed */
#define COMP_Mode_MediumSpeed                COMP_CSR_COMP1MODE_0 /*!< Medium Speed */
#define COMP_Mode_LowPower                   COMP_CSR_COMP1MODE_1 /*!< Low power mode */
#define COMP_Mode_UltraLowPower              COMP_CSR_COMP1MODE   /*!< Ultra-low power mode */

You might want to correct it in future versions.

Kind regards