cancel
Showing results for 
Search instead for 
Did you mean: 

After jump to DFU Bootloader Device resets on DFU command

pmark
Associate

I use JumpToBootloader() to jump to bootloader, device enters bootloader and shows device

i then send it this command

dfu-util -d 0483:df11 -S 305737513432 -a 0 -s 0x08000000:leave -D fw.bin

and device resets 

Erase [ ] 0% 0 bytesdfu-util: Error during special command "ERASE_PAGE" get_status: -9 (LIBUSB_ERROR_PIPE)

If i enter the bootloader via the BOOT pin it works fine

It is like something else needs to be reset ?

 

 

 

dfu-util 0.11-dev

Found DFU: [0483:df11] ver=0200, devnum=44, cfg=1, intf=0, path="20-1.2.1.2", alt=0, name="@Internal Flash /0x08000000/8*128Kg", serial="305737513432"

Found DFU: [0483:df11] ver=0200, devnum=44, cfg=1, intf=0, path="20-1.2.1.2", alt=1, name="@Option Bytes /0x5200201C/01*88 e", serial="305737513432"

 

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.

Copyright 2010-2021 Tormod Volden and Stefan Schmidt

This program is Free Software and has ABSOLUTELY NO WARRANTY

Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

 

 

dfu-util: Warning: Invalid DFU suffix signature

dfu-util: A valid DFU suffix will be required in a future dfu-util release

 

Opening DFU capable USB device...

Device ID 0483:df11

Device DFU version 011a

Claiming USB DFU Interface...

Setting Alternate Interface #0 ...

Determining device status...

DFU state(2) = dfuIDLE, status(0) = No error condition is present

DFU mode device DFU version 011a

Device returned transfer size 1024

DfuSe interface name: "Internal Flash "

Downloading element to address = 0x08000000, size = 135828

 

Erase [ ] 0% 0 bytesdfu-util: Error during special command "ERASE_PAGE" get_status: -9 (LIBUSB_ERROR_PIPE)

 

Return Code: 74

 

 

 

 

void JumpToBootloader(void)

{

uint32_t i=0;

void (*SysMemBootJump)(void);

 

/* Set the address of the entry point to bootloader */

volatile uint32_t BootAddr = 0x1FF09800;

 

/* Disable all interrupts */

__disable_irq();

 

// USB->CNTR = 0x0003;

USBD_DeInit(&hUsbDeviceHS);

HAL_DMA_DeInit(&hdma_adc3);

HAL_DMA_DeInit(&hdma_dac1_ch1);

HAL_DMA_DeInit(&hdma_dac1_ch2);

HAL_DMA_DeInit(&hdma_usart2_tx);

HAL_DMA_DeInit(&hdma_usart3_tx);

 

HAL_CORDIC_DeInit(&hcordic);

HAL_DAC_DeInit(&hdac1);

HAL_UART_DeInit(&huart2);

HAL_UART_DeInit(&huart3);

HAL_ADC_DeInit(&hadc3);

HAL_TIM_Base_DeInit(&htim2);

HAL_TIM_Base_DeInit(&htim3);

HAL_TIM_Base_DeInit(&htim6);

HAL_I2C_DeInit(&hi2c4);

HAL_RTC_DeInit(&hrtc);

// HAL_DeInit();

/* Disable Systick timer */

SysTick->CTRL = 0;

SysTick->LOAD = 0;

SysTick->VAL = 0;

/* Set the clock to the default state */

HAL_RCC_DeInit();

/* Clear Interrupt Enable Register & Interrupt Pending Register */

uint8_t cnt = (sizeof(NVIC->ICER) / sizeof(NVIC->ICER[0]));

for (i=0;i<cnt;i++)

{

NVIC->ICER[i]=0xFFFFFFFF;

NVIC->ICPR[i]=0xFFFFFFFF;

}

 

/* Re-enable all interrupts */

__enable_irq();

/* Set up the jump to booloader address + 4 */

SysMemBootJump = (void (*)(void)) (*((uint32_t *) ((BootAddr + 4))));

 

/* Set the main stack pointer to the bootloader stack */

__set_MSP(*(uint32_t *)BootAddr);

 

/* Call the function to jump to bootloader location */

SysMemBootJump();

 

/* Jump is done successfully */

while (1)

{

/* Code should never reach this loop */

}

}

1 REPLY 1
FBL
ST Employee

Hi @pmark 

Check your flash string descriptor. You need to make sure that the memory paging is set up correctly.

AN3156 outlines the sequence of commands needed for successful firmware update operations. 

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.