Reading the PWM output state on STM32F4
You should read the applicable GPIO input data register, not the output one.  Only when the pin is configured as a GPIO output would they match.

The programmer's manual will explain what the actual register is; the documentation for whatever IO or HAL library you are using will show how to read it at a higher level.

It is also likely that you should be able to read the relevant timer's count register and compare it to the applicable output compare value.