STM32F407 Using GPIO to generate 5V PWM
I am working on the STM32F407 and we made some bad choises when selecting a motor. The motor control signal is 5V hence we need to generate 5V PWM signal using the STM32F407. Sadly, we have wired the GPIO from the STM32F407 directly to the motor control pin.
I am aware about the 3.3V - 5V logic level converters but I was wondering whether it is possible to achieve what I want using just the STM32F407.
I know that some pins are 5V tolerant. For example, PD15 pin on the STM32F047 is 5V tolerant as it is marked with FT:

1. I have configured this GPIO as Output Open Drain:

2. I have soldered 30k OHM resistor from the GPIO8 to 5V
And simply tried to set the ping to high using the following command:
HAL_GPIO_WritePin(GPIO8_GPIO_Port, GPIO8_Pin, 1);
HAL_Delay(1000);
HAL_GPIO_WritePin(GPIO8_GPIO_Port, GPIO8_Pin, 0);I can confirm that the GPIO is toggling between 0 and 5V:

Next, I try to configure PWM for this pin:
1. Enable pin stacking for this pin since I need this pin to be GPIO_Output (to configure Open drain mode) and I need to configure TIM_CH4:


With this configuration, I can confirm that the PWM is working as expected but the voltage only goes up to 3.3V. Could it be that when setting a pin to TIM4, it disables the open drain mode?
In my main.c I simply do:
TIM4->CCR4 = 6000;
HAL_TIM_PWM_Start(&htim4, TIM_CHANNEL_4);

