Page 1 of 1

FW update using dfu-util problem

Posted: 07 Jan 2021 23:56
by vxristodoulou
Hi,
I've been successfully using the USB HID Bootloader to program my STM32. For a couple reasons, I need to update the FW using dfu-util in a MacOS terminal. Using this method, my code is also successfully programmed.

Both methods above work fine when I program a simple LED_blink code. When I use a code that implements the USB (CDC_Demo), the code doesn't start to run, if I programmed it using the second method (dfu-util).

Any ideas what might be wrong? Is it possible that my code does't know where to start? If so, why it happens only when I use the CDC_Demo and not the LED_Blink?

Thank you in advance,

Re: FW update using dfu-util problem

Posted: 11 Jan 2021 09:23
by filip
Hi,

If you use USB HID bootloader to upload the CDC_Demo, does this work ?

Regards,
Filip.

Re: FW update using dfu-util problem

Posted: 12 Jan 2021 17:10
by vxristodoulou
When I use the USB HID Bootloader everything works fine. I narrowed down the problem and seems that the code stucks in the loop below.

WHILE(USBDEV_GETDEVICESTATE() <> _USB_DEV_STATE_CONFIGURED)
WEND

which means the USB device is never configured/enumerated. If I remove this loop, the rest of my code runs properly.

It is unclear to me what is different when I use dfu-util that causes the USB to not be configured.

Your support on this will be much appreciated. Thanks!

Re: FW update using dfu-util problem

Posted: 12 Jan 2021 19:41
by AntiMember
In general, you need to reconnect USB after downloading code.

Re: FW update using dfu-util problem

Posted: 12 Jan 2021 20:47
by vxristodoulou
Thank you for your input AntiMenber. When using the MikroE bootloader, re-connecting the USB is not really necessary as everything works fine.

Though, I have done this after programming with dfu-util but didn't help much.