The USB DFU boot mode is bound to a few requirements which you can read in the following application notes:
AN2606 STM32 microcontroller system memory boot mode
AN3156 USB DFU protocol used in the STM32 bootloader
Please check all requirements for your specific device, such as pins BOOT0 and BOOT1 if applicable, bootloader activation pattern, clock frequency incl. accuracy etc.
Regards
/Peter
In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.