Analog values without Adc STM32
If you compare the schematics, yours don't match how it is supposed to be connected.

If the PB6 was connected to the resistors directly, and the 10nF were connected from PB6 to ground, it would work. Then, the STM32 can discharge the capacitor, and count time until it has been charged.

Also, if the pin is configured into Analog mode, it's not an output, and both the digital input and output buffers are disabled, so it's digital state cannot be set or read.