2017-08-01 12:46 AM
Hi there,
I am trying to use DFU in my application, I have seen the sample codes available in STM32cube package but it requires user button to be pressed in order to enter into DFU mode.
I want my application should go in DFU mode just by using software command (like over USB_CDC if i am sending 'enter DFU' it should enter in DFU mode).
Do I need add USB CDC in DFU code? is it possible to achieve by using cubeMX?
#dfu2017-09-21 05:07 AM
I have done this on a PIC32MX. It would be great if I could do with my STM32F7.
2017-09-21 05:49 AM
I want my application should go in DFU mode just by using software command (like over USB_CDC if i am sending 'enter DFU' it should enter in DFU mode).
This statement is the answer to your next question.
Do I need add USB CDC in DFU code?
Your application needs to have USB CDC functionality to be able to receive the 'enter DFU' command.
It is easy to do this by CubeMx There are also examples inside your device's firmware.
2018-03-01 01:41 AM
'I am trying to use DFU in my application, I have seen the sample codes available in STM32cube package but it requires user button to be pressed in order to enter into DFU mode.'
could you please say exactly where did you find that example code? i am currently looking for it.
2018-03-01 05:26 AM
As I stated above, I did this for a PIC32 implementation. Now I have this working for the STM32. I send a command over the CDC interface. The command sets a 32-bit variable to a specific value then does a soft reset. I inserted code at the beginning of the startup file that checks the variable for the DFU value. If the value is correct, the code sets the SP to the DFU stack and jumps to the DFU vector in flash. This is no more than about 10 lines of C code, plus the command execution code. I do not have any DFU code in my application, I just jump the flash DFU. I realize that there is a 1 in 2^^32 chance that the board will boot with the correct value in the variable. If that is a problem, set an array or string to a longer value.