Configure Marlin for tool changing system
Use a servo. This way you can use the digital pins to control it; or in your specific case PWM_PC9
Connect it to the expansion port and configure one of the digital pins in the marlin configuration file. A servo will go to the minimum position when the pin goes low, and the max position when the pin goes high. I take it you don't need any stops in between since you're doing a tool changer.


If you figure out how to modify the code to support tool changing, I'd be interested to know as well.