Skip to main content
Associate
October 9, 2026
Question

CUBEMX issue while configuring COMP with STM32H503

When Comparator is configured, the init sequence do not generate the option for Positive input selection 
one has to add this line manually, depending on the pin selected as INP. 
hcomp1.Init.InputPlus = COMP_INPUT_PLUS_IO1; 

or
 hcomp1.Init.InputPlus = COMP_INPUT_PLUS_IO2; 

or

hcomp1.Init.InputPlus = COMP_INPUT_PLUS_IO3; 

 

and so Comparator do not work if not checked. 

I am using CubeMX version 6.18.1

5 replies

Ghofrane GSOURI
ST Technical Moderator
October 9, 2026

Hello ​@bhushan_pawar 

I have performed a test using the latest version of STM32CubeMX6.18.1 and the generated code is correct . Please check the screenshots

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.
Associate
October 15, 2026

Thanks sir… for your reply , but when i generated for MDK-ARM and found.. 

I verified once again … but the error remains same… My comparator INP is at PB2

Ghofrane GSOURI
ST Technical Moderator
October 15, 2026

Hello ​@bhushan_pawar 

Thank you for your reply.

I will perform a test using  MDK-ARM and get back to you ASAP.

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.
Associate
October 15, 2026

I verified with your provided test_COMP.ioc.. and the result remains same.. 

But for PA0 it generates… 
 

 

Ghofrane GSOURI
ST Technical Moderator
October 15, 2026

Hello ​@bhushan_pawar 

Thank your for your detailed explanation.

Issue has been escalated to dev team under internal ticket ID #0066638 

I will keep you posted with updates.

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.