Skip to main content
Associate
August 13, 2026
Question

Custom Bootloader works with DFUSE DEMO but not with StmCubeProgrammer

  • August 13, 2026
  • 3 replies
  • 72 views

We have device that has Stm32F405RG T6 Microcontroller. We have been using DFUSE Demo tool to update image.

we have bootloader app (custom bootloader) and main app.

we flash bootloader + app to device using STLINK JTAG.

Custom boot loader checks for certain button to decide if jump to app or remain in DFU mode to upload new image to device.

This works fine with DFUSE demo tool but when we use StmCubeProgrammer (after updating to stm32bootloader usb driver)

it can detect the device in DFU mode on USB but only in read-only mode, we can not write any bin file back to device.

 

3 replies

vv1Author
Associate
August 14, 2026

We don’t use latest USB_DEVICE_LIBRARY can this have any effect? I can see that they still implement DFU protocol 1.1 though there are some minor differences.

Aziz BRIGUI
ST Technical Moderator
August 17, 2026

Hi ​@vv1,

The device does enumerate properly based on your description. I suggest you try aligning write/erase APIs with the example here: STM32CubeF4/Projects/STM324xG_EVAL/Applications/USB_Device/DFU_Standalone/Src/usbd_dfu_flash.c at master · STMicroelectronics/STM32CubeF4.

Aziz

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.
vv1Author
Associate
August 21, 2026

Thanks Aziz,

I have checked the code and our implementation of bootloader is pretty much similar, still no sucess.

int main(void)

{

HAL_Init();

SystemClock_Config();

MX_USB_DEVICE_Init();

//checking flag to goto dfu mode or start application

uint32_t dfu_trigger = flash_read(0x080fe000);

if(dfu_trigger == 1)

{

flash_write(0x080fe000, 0);

}

 

 

if((dfu_trigger == 1))

{

// Run DFU Mode

}

else

{

/* Jump to user application */

JumpAddress = *(__IO uint32_t*) (USBD_DFU_APP_DEFAULT_ADD + 4);

JumpToApplication = (pFunction) JumpAddress;

/* Initialize user application's Stack Pointer */

__set_MSP((*(__IO uint32_t*) USBD_DFU_APP_DEFAULT_ADD ));

JumpToApplication();

}

 

/* Init Device Library */

MX_USB_DEVICE_Init();

while (1)

{

/* USER CODE END WHILE */

/* USER CODE BEGIN 3 */

}

}