The SYSCFG reset bit must be cleared in RCC APBRSTR2, it is active as long as set.
"If I comment the while loop the ADC works fine but its values refers to the 3.3V voltage applied to VREF+Pin and not to the internal 2.048V or 2.500V."
You confirm that no supply is connected on VREF+ when trying to switch ON the buffer? Just the capacitance?