cancel
Showing results for 
Search instead for 
Did you mean: 

Using the STM32F303K6 Comparator and DAC without DAC as GPIO

harris
Associate II

In Cube, setting the Comparator to work with the DAC requires the DAC to be set as a GPIO however, I'd like to use the GPIO pins for other tasks, is this possible or does the DAC need to output on the GPIO for the comparator to work?

4 REPLIES 4
TDK
Guru

I imagine this is supported by the hardware but not by CubeMX. Likely just re-running HAL_PIN_Init on the affected pin in your user code will get it to work correctly without needing to modify CubeMX generated code.

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

Brilliant, thank you! I just wanted to clarify it wasn't a hardware limitation before committing to a PCB.

TDK did not say it *is* possible, but that it is possible that it is possible.

I'm not that sure. Read carefully the RM and errata. The RM at least has IMO contradictory informations in this regard.

In the newer 'H7 and 'Gx, where DAC output structure is different and includes explicit settings with DAC connected only internally, this does not work properly and the DAC, if switched on, is permanently connected to its respective output pin (maybe yet unpublished in official errata, but confirmed on this forum by ST) .

I would recommend you to verify this on a prototype, maybe using a Nucleo board, and perhaps communicate directly to ST.

JW

Piranha
Chief II

Just a similar example with STM32L432KBUx. While selecting pins for a new PCB in CubeMX, OPAMP settings didn't have a mode with VINP connected internally to DAC, but VINM and VOUT routed to external pins. In the real life everything worked as expected and that pin, to which VINP can be assigned, was used for other functionality.