STM32 isn't 5V capable, IIRC. And it's certainly not high side capable, so you still need drive circuitry. And "logic level" drive always sucks (slower switching speed), even with so-called "logic level" parts.
DACs and a dumb MCU (use an ancient PIC for all that matters!
) are a far sight easier, and better, than coming up with your own algorithm that uses inferior hardware resources to deliver suboptimal switching performance. And that's if you already know what you're doing!
Tim