2025-07-01 2:29 PM
For COMP1 on STM32G0 here are the pin assignments from the reference manual
I want PA1 and so I've chosen that in the STM32CubeMX
However, the generated code sets
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
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
2025-07-01 2:55 PM
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.
2025-07-01 5:48 PM
Still happening for me with 6.14.1.
2025-07-03 4:59 AM
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.