cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in STM32CubeMX with COMP

Carl_G
Senior II

For COMP1 on STM32G0 here are the pin assignments from the reference manual

Carl_G_0-1750644467047.png

I want PA1 and so I've chosen that in the STM32CubeMX

Carl_G_1-1750644553274.png

However, the generated code sets 

Carl_G_2-1750644605926.png

and the value of InputPlus is

 

 

/** @defgroup COMP_InputPlus COMP input plus (non-inverting input)
  * @{
  */
#define COMP_INPUT_PLUS_IO1            (0x00000000UL)         /*!< Comparator input plus connected to IO1 (pin PC5 for COMP1, pin PB4 for COMP2, pin PB0 for COMP3 (for devices featuring COMP3 instance)) */
#define COMP_INPUT_PLUS_IO2            (COMP_CSR_INPSEL_0)    /*!< Comparator input plus connected to IO2 (pin PB2 for COMP1, pin PB6 for COMP2, pin PC1 for COMP3 (for devices featuring COMP3 instance)) */
#define COMP_INPUT_PLUS_IO3            (COMP_CSR_INPSEL_1)    /*!< Comparator input plus connected to IO3 (pin PA1 for COMP1, pin PA3 for COMP2, pin PE7 for COMP3 (for devices featuring COMP3 instance)) */

 

Which apparently maps to PB2 which is wrong!

 

On the other hand, COMP2 I have chosen PB6 and its getting 

Carl_G_4-1750644871312.png

COMP2 seems to be right but COMP1 is not.

I have reconfirmed this after forgetting about it and spending hours debugging why my COMP was triggering instantly.  Definitely a bug.

Version 6.14.0
STM32G071CBU

 

 

3 REPLIES 3
TDK
Super User

Can't find the thread, but this was reported a bit ago and appears fixed in the latest CubeMX version (6.14.1). At least, the bug can't be duplicated here.

TDK_1-1751406835908.png

TDK_0-1751406825930.png

 

If you feel a post has answered your question, please click "Accept as Solution".
Carl_G
Senior II

Still happening for me with 6.14.1.

Hello @Carl_G 

Could you please provide your IOC.

I will be waiting for your feedback.

THX

Ghofrane

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.