This happened to me just now when I loaded a pin configuration meant for a STM32F411VET6 to a STM32F411CEU6.
As rubenayl said, connect while holding reset. In my case I had to keep doing this every time I wanted to connect to the chip. What worked for me was doing a "Full chip Erase" using the STM32CubeProgrammer.