Skip to main content
Associate II
June 23, 2026
Solved

STM32C5 MCU COMP2_IN Pins assignment

  • June 23, 2026
  • 4 replies
  • 167 views

Dear Gentlemen,

as a relative beginner using STM32C5 MCU-s,
I need your help to resolve one issue.

Namely,

In new design,  where planned MCU is STM32C542CCT6 device, (LQFP48 package),
I plan to use internal Comparator COMP2.

Problem (for me) arises when I have to declare connection between Comparator nodes
(INP-  (M), INP + (P) and OUTPUT) with some specific pins on LQFP48 package,
    more precisely it would be ideal for me to use 
PA7 pin as Comparator2 Output
and pin PA2 as Comparator2 -INPut, 
and pin PA3 as Comparator2 +INPut.

In short,
it is not a problem to "connect" Comparator Output, COMP2_OUT as shown in 
Table 12 STM32C542xx pin/ball definition, on STM32C542xx data sheet (DS), page 41, or in 
Table 13 Alternate functions, 

since i will declare AF14 = COMP2_OUT in appropriate GPIOA_AFRL register, 
see page 352 in RM0522 Reference manual, (RM)

but I have problem to declare Comparator2 INPut pins, since it is selected thru peripheral registers,
as stated in Table 11 in device DS, 
...Additional functions / Functions directly selected/enabled through peripheral registers...

However, 
when I look at Comparator2 INPSEL bits, from page 712 in RM
Table 169. COMP implementation non-inverting input assignment for STM32C53x/542

I see three (3) Input signals, with "names"
COMP2_INP1
COMP2_INP2
COMP2_INP3

also,
when I look at Comparator2 INMSEL bits, from page 714 in RM
Table 172. COMP inverting input assignment

I see three (3) Input signals, with "names"
COMP2_INM1
COMP2_INM2
COMP2_INM3

but, in DS page 41,
Pin name PA2 could be connected with Additional functions :
ADC1_IN2,
COMP2_INM,
OPAMP1_VINM0,
TAMP_IN3, WKUP2

my question is, what I have to do, 
to "connect" pin PA2 with COMP2_INM, and with one of three(3) 
COMP2_INM1
COMP2_INM2
COMP2_INM3 choices ?


Besides, the very same question is :

in DS page 41,
Pin name PA3 could be connected with Additional functions :
ADC1_IN3,
COMP2_INP

my question is, what I have to do, 
to "connect" pin PA3 with COMP2_INP, and with one of three(3) 
COMP2_INP1
COMP2_INP2
COMP2_INP3 choices ?

Many thanks for your help !

Best answer by mƎALLEm

Hello ​@blaziBUCK and welcome to the ST community,

I’m not sure I understood the question. Are you asking about the correspondence between COMP2_INPx/COMP2_INMx and the GPIO pin (which IO pin)?

By using CubeMX2 tool 

COMP2_INP:

IO1: PA3

IO2: PB15

IO3: PC0

COMP2_INM:

IO1: PC1

IO2: PC5

IO3: PA2

Meanwhile, I don’t see the I/O correspondence with COMPx-INy in the documentation.

I’m checking internally. Internal ticket for follow-up: CDM0063783

4 replies

mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
June 23, 2026

Hello ​@blaziBUCK and welcome to the ST community,

I’m not sure I understood the question. Are you asking about the correspondence between COMP2_INPx/COMP2_INMx and the GPIO pin (which IO pin)?

By using CubeMX2 tool 

COMP2_INP:

IO1: PA3

IO2: PB15

IO3: PC0

COMP2_INM:

IO1: PC1

IO2: PC5

IO3: PA2

Meanwhile, I don’t see the I/O correspondence with COMPx-INy in the documentation.

I’m checking internally. Internal ticket for follow-up: CDM0063783

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
mƎALLEm
ST Technical Moderator
June 24, 2026

@blaziBUCK 

This post has been marked by you as Best Answer. Did you unmark it?

 

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
blaziBUCKAuthor
Associate II
June 24, 2026

Dear ST Technical Moderator,
(mEALLEm)

Yes,

I unmarked it for a moment/Temporarily,  until I got reply to my second message,

if possible to get some code snippet as generated in CubeMX2…

 

Then, I hope the problem is completely solved with your help !

(besides, what about the documents, not mentioning the “correspondence ” ?)

 

best regards,

Blazimir

mƎALLEm
ST Technical Moderator
June 24, 2026

@blaziBUCK 

A new question = new post.

I need to move the second question to CubeMx forum board with label CubeMx2.

I’ve already moved it: 

When the correspondence of COMP input pins with I/Os this post should be closed.

Thank you.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.