Skip to main content
Khira.1
Associate
January 2, 2021
Solved

Fail to upgrade with DFU

  • January 2, 2021
  • 1 reply
  • 937 views

Hi all,

An LED is connected as below.

PA1 --- Resistor --- LED --- 3.3V

Build test.bin from source code shown below using STM32CubeIDE.

 while (1)

 {

  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_1);

  HAL_Delay(200);

 }

Create test.dfu from the test.bin.

Connect a board to PC via USB, and "STM Device in DFU Mode" appears in Device Manager.

Try to upgrade the test.dfu into the board using DfuSeDemo.

A message "Your device was plugged in DFU mode. So it is impossible to make sure this file is correct for this device." pops up.

Click "YES."

A message "Upgrade successful !" is shown.

Disconnect USB from the PC, connect BOOT0 to GND and re-connect USB to the PC.

An LED blinks with an interval of 2sec. Which maybe a demo exe pre-installed. So, it seems to fail to install my program.

Could anybody tell me solution?

Thank you.

This topic has been closed for replies.
Best answer by Khira.1

Thank you.

It works well with *.dfu created from *.hex.

And, *.hex can be created under settings as below.

  1. Select "Properties" in a list shown by right click on the project
  2. Click "Settings" in "C/C++ Build"
  3. In "Tool Settings" tab, select "MCU Post build outputs"
  4. Check on "Convert to Intel Hex file (-O ihex)"
  5. Click "Apply and Close" button

1 reply

MM..1
Chief III
January 2, 2021

Create your dfu from hex, not from bin.

Khira.1
Khira.1AuthorBest answer
Associate
January 2, 2021

Thank you.

It works well with *.dfu created from *.hex.

And, *.hex can be created under settings as below.

  1. Select "Properties" in a list shown by right click on the project
  2. Click "Settings" in "C/C++ Build"
  3. In "Tool Settings" tab, select "MCU Post build outputs"
  4. Check on "Convert to Intel Hex file (-O ihex)"
  5. Click "Apply and Close" button