So I'm currently working on a product on the stm32f4 and we're trying to implement a simple firmware upgrade. The first solution that we used was to have a link on the board that you could use to connect BOOT0 to VD and then trigger a power cycle and when the device reboots it would boot up into DFU mode. This works but has the disadvantage that to access the link you have to unscrew the back of the device which isn't ideal when you are asking a customer to do it.
The next option was to have a USB command that we recognise in our code which sets a value (DEADBEEF) to a register address and then trigger a software restart, then upon startup that address is checked and if it is set it will force the uC into DFU mode.
This second method is much better other than the small issue that occurs due to the face that we enable read protection on the chip. as part of the upgrade process, we have to erase the flash once this has finished the chip reboots however as the "DEADBEEF" has been cleared it doesn't boot into DFU mode.
Is anyone aware of a workaround to make the STM32F4 reboot into DFU mode after erasing the memory?