STM32duino bootloader Linux confusion.

STM32duino bootloader aka Maple bootloader
MasterT
Posts: 12
Joined: Wed Mar 08, 2017 4:17 am

STM32duino bootloader Linux confusion.

Post by MasterT » Sat Mar 11, 2017 9:40 am

HI,
I installed STM32duino bootloader following instructions on this web site https://medium.com/@paramaggarwal/progr ... .tppplljtw

But uploading doesn't work, my own research turns blank, so here is my questions, sorry if it was asked many times:
1. Error:
An error occurred while uploading the sketch
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
dfu-util: Cannot open DFU device 1eaf:0003
dfu-util: No DFU capable USB device available

2. My troubleshooting:
[69238.681209] usb 1-2.3: new full-speed USB device number 63 using xhci_hcd
[69238.758601] usb 1-2.3: New USB device found, idVendor=1eaf, idProduct=0004
[69238.758616] usb 1-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[69238.758625] usb 1-2.3: Product: Maple
[69238.758633] usb 1-2.3: Manufacturer: LeafLabs
[69238.761362] cdc_acm 1-2.3:1.0: ttyACM0: USB ACM device
XXXXXXX arduino-1.8.1]$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 0bda:57b8 Realtek Semiconductor Corp.
Bus 001 Device 003: ID 04f3:0389 Elan Microelectronics Corp.
Bus 001 Device 063: ID 1eaf:0004
It looks like DFU is trying to open 0003 but lsusb shows 0004, how this can be fixed?

And another question, could be related to an error, command line
/arduino-1.8.1/hardware/Arduino_STM32/tools/linux/maple_upload ttyACM0 2 1EAF:0003 /tmp/arduino_build_194473/Blink.ino.bin

says "linux", same time my PC running linux64, is it o'k?

User avatar
martinayotte
Posts: 1213
Joined: Mon Apr 27, 2015 1:45 pm

Re: STM32duino bootloader Linux confusion.

Post by martinayotte » Sat Mar 11, 2017 4:29 pm

MasterT wrote: It looks like DFU is trying to open 0003 but lsusb shows 0004, how this can be fixed?
In boards.txt ...

MasterT
Posts: 12
Joined: Wed Mar 08, 2017 4:17 am

Re: STM32duino bootloader Linux confusion.

Post by MasterT » Sat Mar 11, 2017 4:38 pm

Well, my board.txt is empty..
[NoName@localhost tools]$ pwd
/home/NoName/Softvari/arduino-1.8.1/hardware/Arduino_STM32/tools
[NoName@localhost tools]$ ls -l
total 16
-rw-rw-r--. 1 NoName NoName 0 Feb 25 21:26 boards.txt
drwxrwxr-x. 6 NoName NoName 4096 Feb 25 21:26 linux
drwxrwxr-x. 6 NoName NoName 4096 Mar 11 04:04 linux64
drwxrwxr-x. 6 NoName NoName 4096 Feb 25 21:26 macosx
drwxrwxr-x. 7 NoName NoName 4096 Feb 25 21:26 win

User avatar
martinayotte
Posts: 1213
Joined: Mon Apr 27, 2015 1:45 pm

Re: STM32duino bootloader Linux confusion.

Post by martinayotte » Sat Mar 11, 2017 4:41 pm

No, the one in Arduino_STM32/STM32F1/boards.txt .

MasterT
Posts: 12
Joined: Wed Mar 08, 2017 4:17 am

Re: STM32duino bootloader Linux confusion.

Post by MasterT » Sat Mar 11, 2017 5:00 pm

O'K, I changed to 0004, and now I see correct command line address
/hardware/Arduino_STM32/tools/linux/maple_upload ttyACM0 2 1EAF:0004 /tmp/arduino_build_982847/Blink.ino.bin
dfu-util 0.8

dfu-util: Invalid DFU suffix signature
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

An error occurred while uploading the sketch
dfu-util: Cannot open DFU device 1eaf:0003
dfu-util: No DFU capable USB device available
But why error messag e still saying "Cannot open DFU device 1eaf:0003" and doesn't uploading?

User avatar
martinayotte
Posts: 1213
Joined: Mon Apr 27, 2015 1:45 pm

Re: STM32duino bootloader Linux confusion.

Post by martinayotte » Sat Mar 11, 2017 6:57 pm

Good question ...
Maybe to debug further you can edit the script /hardware/Arduino_STM32/tools/linux/maple_upload, and just before the last line adding an echo would help :

Code: Select all

echo "${DFU_UTIL}" -d ${usbID} -a ${altID} -D ${binfile} ${dfuse_addr} -R
"${DFU_UTIL}" -d ${usbID} -a ${altID} -D ${binfile} ${dfuse_addr} -R
Then, you could try copy/paste this echo as a new command.

MasterT
Posts: 12
Joined: Wed Mar 08, 2017 4:17 am

Re: STM32duino bootloader Linux confusion.

Post by MasterT » Sat Mar 11, 2017 8:06 pm

I insert a line, as advised:
Sketch uses 16056 bytes (24%) of program storage space. Maximum is 65536 bytes.
Global variables use 2816 bytes of dynamic memory.
/home/NoName/Softvari/arduino-1.8.1/hardware/Arduino_STM32/tools/linux/maple_upload ttyACM0 2 1EAF:0004 /tmp/arduino_build_299861/Blink.ino.bin
/home/NoName/Softvari/arduino-1.8.1/hardware/Arduino_STM32/tools/linux/dfu-util/dfu-util -d 1EAF:0004 -a 2 -D /tmp/arduino_build_299861/Blink.ino.bin -R
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

dfu-util: An error occurred while uploading the sketch
Cannot open DFU device 1eaf:0003
dfu-util: No DFU capable USB device available
No luck. :(

MasterT
Posts: 12
Joined: Wed Mar 08, 2017 4:17 am

Re: STM32duino bootloader Linux confusion.

Post by MasterT » Sat Mar 11, 2017 8:18 pm

And more confusion, port ttyACM0 belongs to dialout group, this what i used to in all arduino releases, nevertheless rules file 45-maple.rules says
ATTRS{idProduct}=="1001", ATTRS{idVendor}=="0110", MODE="664", GROUP="plugdev"
ATTRS{idProduct}=="1002", ATTRS{idVendor}=="0110", MODE="664", GROUP="plugdev"
ATTRS{idProduct}=="0003", ATTRS{idVendor}=="1eaf", MODE="664", GROUP="plugdev" SYMLINK+="ttyUSB%n"
ATTRS{idProduct}=="0004", ATTRS{idVendor}=="1eaf", MODE="664", GROUP="plugdev" SYMLINK+="maple"
I modify a symlink from maple to ttyUSB%n yesterday, probably should do the same for device 0004 now, but in device list it has name ttyACM0, where it cames from? And group, should it be dialout?

MasterT
Posts: 12
Joined: Wed Mar 08, 2017 4:17 am

Re: STM32duino bootloader Linux confusion.

Post by MasterT » Sat Mar 11, 2017 8:28 pm

Yes, I got it! Group name is wrong, here is how rules file 45-maple.rules should be:
ATTRS{idProduct}=="1001", ATTRS{idVendor}=="0110", MODE="664", GROUP="dialout"
ATTRS{idProduct}=="1002", ATTRS{idVendor}=="0110", MODE="664", GROUP="dialout"
ATTRS{idProduct}=="0003", ATTRS{idVendor}=="1eaf", MODE="664", GROUP="dialout" SYMLINK+="ttyUSB%n"
ATTRS{idProduct}=="0004", ATTRS{idVendor}=="1eaf", MODE="664", GROUP="dialout" SYMLINK+="ttyUSB%n"

Thank you for your help. :)

ag123
Posts: 717
Joined: Thu Jul 21, 2016 4:24 pm

Re: STM32duino bootloader Linux confusion.

Post by ag123 » Tue Mar 28, 2017 7:57 pm

oops i'm rather late in this reply, to play with dfu-util sketch install on leaflab maple style boards,
one way is to boot into *perpetual bootloader mode*

http://docs.leaflabs.com/static.leaflab ... oader-mode
Perpetual Bootloader Mode

In this mode, Maple stays a DFU device and does not jump to user code until the next reset. This is useful for guaranteeing that your Maple will be available for reprogramming.

To put your Maple (or other Maple board) into perpetual bootloader mode:

Plug your board into the USB port.
Hit the reset button (it’s the button labeled RESET). Notice that your board blinks quickly 6 times, then blinks slowly a few more times.
Hit reset again, and this time push and hold the other button during the 6 fast blinks (the normal button is labeled BUT). You can release it once the slow blinks start.
here is my dfu-util struggle with a different board from olimex
https://www.olimex.com/forum/index.php? ... 6#msg22436
^^^ i commented in my post there, if you made *finger errors* playing with the boot and user buttons, u may fall into serial (uart) flash update mode
that is neither dfu nor the normal running mode, it is a '3rd mode' to flash the stm32 directly via uart serial links, when 'no led lights up'
Hit the reset button on your Maple (it’s the small button at the bottom left, labeled
RESET). Notice that it blinks quickly 6 times, then blinks slowly a few more times.
Hit reset again, and this time push and hold the other button **during** the 6 fast blinks
(the button is on the top right; it is labeled BUT). You can release it once the slow
blinks start.
Your Maple is now in perpetual bootloader mode.
if you see 1eaf:0004 when running lsusb command this is the normal running mode (your sketch is installed and running)
if you see 1eaf:0003 when running lsusb that is maple in 'perpetual bootloader mode' ready to load the sketch

and make sure you use a good shielded usb cable, i've tried a lousy unshielded usb cable which results in lots of errors and failed sketch install
Last edited by ag123 on Tue Mar 28, 2017 8:21 pm, edited 6 times in total.

Post Reply