mcci-catena / Arduino_Core_STM32

STM32 core support for Arduino
2 stars 7 forks source link

Uploading on Linux Fails #180

Closed mhmayyan closed 2 years ago

mhmayyan commented 2 years ago

Hi,

Every time I upload on Linux I get the following:-

Program file:   /tmp/arduino_build_120438/CatenaSketch.ino.dfu
Board VID:PID:  0x040E:0x0091
Base address:   0x08005000
Bootloader:     /home/user/.arduino15/packages/mcci/hardware/stm32/3.0.3/bootloaders/McciBootloader_46xx.bin
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 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/

Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
dfu-util: Non-valid multiplier 'g', interpreted as type identifier instead
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash  "
Downloading to address = 0x08000000, size = 10768
Download    [=========================] 100%        10768 bytes
Download done.
File downloaded successfully
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 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/

Match vendor ID from file: 040e
Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
the selected serial port Setting Alternate Setting #0 ...
 does not exist or your board is not connected
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
main upload failed
dfu-util: Error: File ID 040e:0091 does not match device (040e:df11 or 0483:df11)
terrillmoore commented 2 years ago

@mhmayyan sorry you're having troubles.

Your device is dropping out of DFU mode after the first download. That's odd; it could be due to a number of different issues. We'll try to reproduce here.

But the good news is that the first step (bootloader download) is working. You really only have to do that once. If you choose "DFU without bootloader" in the UI, it will only download the app, which should work. That is:

image

mhmayyan commented 2 years ago

I tried to do that but I still have the same problem.

/home/user/.arduino15/packages/mcci/hardware/stm32/3.0.3/tools/linux/stm32l0-upload -vx 0x040E 0x0091 /tmp/arduino_build_120438/CatenaSketch.ino.dfu 0x08005000 
Program file:   /tmp/arduino_build_120438/CatenaSketch.ino.dfu
Board VID:PID:  0x040E:0x0091
Base address:   0x08005000
Bootloader:     using existing bootloader
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 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/

Match vendor ID from file: 040e
Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
dfu-util: Error: File ID 040e:0091 does not match device (040e:df11 or 0483:df11)
dfu-util: Error: File ID 040e:0091 does not match device (040e:df11 or 0483:df11)

Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
main upload failed
terrillmoore commented 2 years ago

Device ID dfu-util: Error: File ID 040e:0091 does not match device (040e:df11 or 0483:df11)

The device ID 040e:0091 says it's not in DFU mode, it's still in application mode.

mhmayyan commented 2 years ago

I tried flashing multiple Catena 4612 boards on two Ubuntu machines but I kept having the same problem either with or without the trusted bootloader. I don't see this problem on Windows 10.

terrillmoore commented 2 years ago

Sorry you're having problems; we'll try to duplicate here.

dhineshkumarmcci commented 2 years ago

We were able to reproduce the issue with BSP versions post v2.8.0. We are working on fixing the issue and come up with solution.

terrillmoore commented 2 years ago

This got auto-closed by the pull request which was just merged. You should be able to patch your release by downloading the file (https://raw.githubusercontent.com/mcci-catena/Arduino_Core_STM32/main/tools/linux/stm32l0-upload), and putting into tools/linux in your BSP copy. Or you may have to wait for a little while, as we'll have to prepare a release.

terrillmoore commented 2 years ago

Release has been tagged. Now we have to update the arduino-boards repo. https://github.com/mcci-catena/arduino-boards/issues/29.

terrillmoore commented 2 years ago

@mhmayyan please update your BSP to v3.0.4 and try. We believe this is now fixed. (Very small chance of an error in json file for the BSP as I don't have a proper test setup.)

mhmayyan commented 2 years ago

I tested the new BSP (V3.0.4). It works now on Linux (Ubuntu) and Windows 10. Thank you.

terrillmoore commented 2 years ago

@mhmayyan thanks for confirming.