Skip to main content
Associate
June 16, 2026
Solved

STM32C5 - can you route internal opamp output to ADC internally?

  • June 16, 2026
  • 1 reply
  • 36 views

Dear Engineers, 
is there any way of routing the internal OPAMP output of the STM32C5 to an ADC directly, or can it only be wired to the COMP1 ?
CubeMX2 doesnt let you pick OPAMP as an input to neither ADC nor COMP, but i did find some notes on beeing able to route the OPAMP output to COMP1 minus input in the LL code somewhere.

If yes, is there a way to do this within MX2, or does it have to be written by hand in code?
Also, the datasheet shows a pin output option for the OPAMPs output on PA6. 
I know you could route form PA6 to a neighboring ADC input capable pin, but not only would that occupy 2 pins, my PA6 is in use for UART, so not usable in my case. 

Thanks in advance.

Best answer by Philippe Cherbonnel

Hello,

On STM32C5 series, there is no internal direct connection between OPAMP output and ADC.

As you mentioned, connection can be made through GPIO: GPIO in mode analog can be shared by multiple peripherals (OPAMP, DAC, COMP, ADC).

Example with STM32C542xx:

  • OPAMP1 output on PA6
  • ADC channel 6 on PA6
CubeMX2 pinout view with PA6 shared by ADC and OPAMP

For your use case: PA6 is already used by UART and is the only output of OPAMP1, there is no obvious solution.

An alternative could be to use other GPIO for UART, if possible at board level, to free PA6 for OPAMP.

 

Best regards

Philippe

1 reply

Philippe Cherbonnel
ST Employee
June 17, 2026

Hello,

On STM32C5 series, there is no internal direct connection between OPAMP output and ADC.

As you mentioned, connection can be made through GPIO: GPIO in mode analog can be shared by multiple peripherals (OPAMP, DAC, COMP, ADC).

Example with STM32C542xx:

  • OPAMP1 output on PA6
  • ADC channel 6 on PA6
CubeMX2 pinout view with PA6 shared by ADC and OPAMP

For your use case: PA6 is already used by UART and is the only output of OPAMP1, there is no obvious solution.

An alternative could be to use other GPIO for UART, if possible at board level, to free PA6 for OPAMP.

 

Best regards

Philippe

Associate
June 17, 2026

Alright. Thank you very much for the confirmation. 
Sincerely, 
Fabian