dfu/upload not perfectly working

aster
Thu Apr 06, 2017 11:05 pm
So fist of all thank to bring such a powerful mcu to hobbyst use :D
then, I know this is not a “product” in the meaning that it must be perfect. anyway i am having some boring issues uploading sketches on my maple mini
usually to upload a new one i need to press the reset and then the user button 32, i read somewhere that in this way it goes in another bootloader mode (led blinking quite fast), correct?
another problem is that if i am not wrong everytime that i open the serial port the board should reset, it doesn’t happen

hardware/software:
maple mini (aliexpress clone)
linux ubuntu 16.04 64bit
booatloader 2.0
dfu-util package installed
rules as described in the wiki added

lsusb output:
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 04f2:b404 Chicony Electronics Co., Ltd
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 047: ID 1eaf:0004
Bus 003 Device 002: ID 1d57:fa20 Xenta
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

dmesg:
[ 7575.010217] usb 3-2: USB disconnect, device number 47
[ 7579.950074] usb 3-2: new full-speed USB device number 48 using xhci_hcd
[ 7580.091227] usb 3-2: New USB device found, idVendor=1eaf, idProduct=0003
[ 7580.091232] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 7580.091234] usb 3-2: Product: Maple 003
[ 7580.091237] usb 3-2: Manufacturer: LeafLabs
[ 7580.091239] usb 3-2: SerialNumber: LLM 003
[ 7581.453636] usb 3-2: USB disconnect, device number 48
[ 7581.750083] usb 3-2: new full-speed USB device number 49 using xhci_hcd
[ 7581.891284] usb 3-2: New USB device found, idVendor=1eaf, idProduct=0004
[ 7581.891287] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 7581.891300] usb 3-2: Product: Maple
[ 7581.891301] usb 3-2: Manufacturer: LeafLabs
[ 7581.891720] cdc_acm 3-2:1.0: ttyACM0: USB ACM device

ide output when it doesn’t upload the sketch:
Archiving built core (caching) in: /tmp/arduino_cache_492532/core/core_Arduino_STM32_STM32F1_mapleMini_bootloader_version_bootloader20,cpu_speed_speed_48mhz_8ad891375d27bd2b96fe3dd8f4606ea0.a
Lo sketch usa 13084 byte (10%) dello spazio disponibile per i programmi. Il massimo è 122880 byte.
Le variabili globali usano 2816 byte di memoria dinamica.
/media/vincenzo/HardDisk/Storage/Programmi/Arduino/hardware/Arduino_STM32/tools/linux/maple_upload: riga 29: /media/vincenzo/HardDisk/Storage/Programmi/Arduino/hardware/Arduino_STM32/tools/linux/upload-reset: File o directory non esistente
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 [email protected]

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
dfu-util: No DFU capable USB device available
Errore durante il caricamento dello sketch

IDE output when i go in the other mode so i am able to upload the sketch:
Lo sketch usa 13084 byte (10%) dello spazio disponibile per i programmi. Il massimo è 122880 byte.
Le variabili globali usano 2816 byte di memoria dinamica.
/media/vincenzo/HardDisk/Storage/Programmi/Arduino/hardware/Arduino_STM32/tools/linux/maple_upload: riga 29: /media/vincenzo/HardDisk/Storage/Programmi/Arduino/hardware/Arduino_STM32/tools/linux/upload-reset: File o directory non esistente
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 [email protected]

Opening DFU capable USB device…
ID 1eaf:0003
Run-time device DFU version 0110
Claiming USB DFU Interface…
Setting Alternate Setting #2 …
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!

Download [ ] 0% 0 bytes
Download [= ] 7% 1024 bytes
Download [=== ] 14% 2048 bytes
Download [===== ] 21% 3072 bytes
Download [======= ] 29% 4096 bytes
Download [========= ] 36% 5120 bytes
Download [========== ] 43% 6144 bytes
Download [============ ] 50% 7168 bytes
Download [============== ] 58% 8192 bytes
Download [================ ] 65% 9216 bytes
Download [================== ] 72% 10240 bytes
Download [=================== ] 79% 11264 bytes
Download [===================== ] 87% 12288 bytes
Download [======================= ] 94% 13084 bytes
Download [=========================] 100% 13084 bytes
Download done.
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
Resetting USB to switch back to runtime mode

i have to clarify that i am a hobbyist on my first tests with linux (installed yesterday) even if i try to study as much as i can sometimes i am not able to solve this kind of problems on my own… i think i wrote all i know, any help would be very appreciated!


zmemw16
Fri Apr 07, 2017 2:47 am
yep, press reset, if you only have just a single device plugged in, check the port is selected.

i usually have more than one serial port connected, the port will need selecting correctly only if its not the last serial interface connected.
i plug in, in sequence
open logic sniffer on /dev/ttyACM0
usb-serial1 on /dev/ttyUSB0, connect uart1 pa9/pa10, & gnd almost always
usb-serial2 on /dev/ttyUSB1, connect is a maybe on uart2
then i connect the board, which is usually /dev/ttyACM1or /dev/ttyUSB2, if i connect it before the usb-serials then it will need to be selected again between ttyUSB0 and ttyUSB2/3 as ttyUSB1 ( and ttyUSB2? ) is / are in use
stlink is usual but it’s not mapped to /dev/tty*

this mainly because i also use bare metal with unicore-mx library. i always upload via stlink on either one.
btw istr that /dev/ttyACMn increments on a reset?? or is it power sequence, limit is ttyACM31

stephen


ag123
Fri Apr 07, 2017 1:36 pm
the usual ‘hello world’ is to blink a led
for the maple mini (clones) the led is normally on board and i’d think the arduino ‘hello world’ blinky sketch pretty much works out-of-the-box
https://www.arduino.cc/en/tutorial/blink

if things didn’t work, lookup the board layouts and schematics to see where those pins are routed
good sources of info are in the wiki
http://wiki.stm32duino.com/index.php?ti … 103_boards
http://wiki.stm32duino.com/index.php?title=Maple_Mini
http://wiki.stm32duino.com/index.php?title=Blue_Pill


aster
Fri Apr 07, 2017 4:27 pm
Thanks stephen for your answer
To be honest I wouldn t say it is a plug and play :?

the port will need selecting correctly only if its not the last serial interface connected.

interesting i didn t know it, now i understood the reason why it didn t worked!
I think that your approach of using ACM0 for programming and the pa9/10 for serial is the best one. To be honest i didn t understood all your message

Somewhere i read that the maple mini changes the indexing of the serial ports, could someone confirm it?

Ag123 the board is a maple mini as in the link you posted


zmemw16
Fri Apr 07, 2017 7:21 pm
it’s a openbench logic sniffer on ACM0, connect up to 16 digitals and capture at up to 200MHz. yeah, i believe that too :)
buffer is only 24k, so a short time at rate.
also anything connecting to the target, it’s signals and ground except for things you power from it.
if the boards usb is the last thing connected, it’ll stay last
rest will arrive with age :D not seeing a tongue in cheek smiley

stephen


ag123
Fri Apr 07, 2017 10:28 pm
try putting the maple mini in perpetual boot loader mode:
http://docs.leaflabs.com/static.leaflab … oader-mode
viewtopic.php?f=32&p=25537#p25537
https://www.youtube.com/watch?v=rvNIeKuXsxM

perpetual boot loader mode keeps the maple mini in the dfu mode, which is needed to install the sketch
i’ve documented my initial novice struggles in the 2nd link above


aster
Mon Apr 10, 2017 10:04 pm
Thank ag the post and video you posted helped me understand how to correctly put in in dfu mode (before i just used to press them randomly)

I would like to ask you some questions since looks like you had my identical problems/question using this board. I would like to say that i already use it and it works but i love to understand “things”
The dfu mode = perpetual boot loader mode = boot0 1 & boot1 0 (sistem memory)?
What is by the way the ram memory? I remember that the first time i plugged the maple in my pc the led started blinking superfast, it was that mode? Or it was the original bootloader?
Why i could choose the cpu speed of 72 and 48? There is a particular reason? Not considering current saving projects


stevestrong
Tue Apr 11, 2017 7:35 am
aster wrote:Why i could choose the cpu speed of 72 and 48? There is a particular reason? Not considering current saving projects

ag123
Tue Apr 11, 2017 2:23 pm
aster wrote:Thank ag the post and video you posted helped me understand how to correctly put in in dfu mode (before i just used to press them randomly)

I would like to ask you some questions since looks like you had my identical problems/question using this board. I would like to say that i already use it and it works but i love to understand “things”
The dfu mode = perpetual boot loader mode = boot0 1 & boot1 0 (sistem memory)?
What is by the way the ram memory? I remember that the first time i plugged the maple in my pc the led started blinking superfast, it was that mode? Or it was the original bootloader?
Why i could choose the cpu speed of 72 and 48? There is a particular reason? Not considering current saving projects


aster
Sat Apr 15, 2017 3:59 pm
very helpfull post ag123, I am answering only now since i wanted to test the upload with dfu-util and these holidays gave me the time
if i didn’t understand wrong with the -a command i can choose where i want to put my sketch
so i can’t choose -a 0 since it is the start of the ram memory where there is the bootloader
-a 1/2 i will upload the .bin using the board bootloader

there is something weird that i don’t understand, why i could choose to upload the sketch in position 0x8005000 or 0x8002000? usually someone want to upload at the end of the bootloader so i should set -a 2 (0x8002000) indeed when i tried with -a 1 it didn’t worked!

Anyway just for your fun i would tell you that I thought that i was able to upload a sketch using any usb-serial converter wrapped on the serial1 :roll: i will buy a st-link clone since they are cheap and if i will ever mess with the bootloader i will be able to upload it again


ag123
Mon Apr 17, 2017 10:12 pm
hi aster,
is your boot loader the stock bootloader or the stm32duino bootloader?
to tell that you need to run dfu-util -l on the command line
search for that, goto the directory where you installed arduino ide, and run find . -name dfu-util
find . -name dfu-util
./hardware/Arduino_STM32/tools/linux64/src/dfu-util
./hardware/Arduino_STM32/tools/linux64/dfu-util
./hardware/Arduino_STM32/tools/linux64/dfu-util/dfu-util
./hardware/Arduino_STM32/tools/linux/src/dfu-util
./hardware/Arduino_STM32/tools/linux/dfu-util
./hardware/Arduino_STM32/tools/linux/dfu-util/dfu-util

aster
Tue Apr 18, 2017 7:56 pm
I have the stm32duino bootloader 2.0. it was my inauguration sketch of the board since it was loaded as first
I already played a little bit with dfu-util, in the last post i wrote you that i wasn’t able to upload a .bin using “-a 1” and i was wondering why this address is still there since using the stm32duino booatloader i should be able to upload at 0x8002000 and not 0x8005000

It is not something important it is just a stupid curiosity


zmemw16
Tue Apr 18, 2017 11:49 pm
well part A fits the title perfectly

i tend to use only a st-link egg for uploads on the jtag 20w
while trying the various F407 versions (HAL/libmaple) i noticed that the restart doesn’t always happen.
then a reset always does, but not sure if an immediate recompile and download always does?

btw
black f4vet v f4zet, notation on the vet schematic says FSMC_A18 for vet, zet is mentioned twice, FSMC_A6 for zet and lcd_bl is only(wag) for zet on FSMC_NE4

stephen


aster
Wed Apr 19, 2017 7:25 am
About the st link, i just saw this topic: http://www.stm32duino.com/viewtopic.php?t=122
I am quite sure that even for the blackpill it would work, and in this way i should have a more powerful programmer than the st link (even if i don t have any idea how to do in-chip debugging, yet)

ag123
Wed Apr 19, 2017 8:16 am
i think the open sourced Black Magic Probe is something good to try out, i’ve not tried that myself though, it works somewhat differently compared to the likes of st-link or those openocd ft2232 based jtag/swd dongles

i think the BMP runs a gdb server on the soc itself, which means that probably even things like openocd isn’t needed, you can most likely connect to it directly from gdb

in a way the ‘status quo debug/flash interfaces’ are things like st-link (which is st propriety) and openocd ft2232 jtag/swd. but i’d think we’d not need to keep sticking with the ‘status quo’, BMP may be a good alternative in that sense. best of all it’d seem it can be flashed on any blue pill or maple mini
(but a small catch is that you may need a uart dongle or st-link firsthand to flash that at 0x8000000)

another way is to use a spare blue pill/maple mini and flash a ‘sketch’ that basically turns usb-serial to usb-uart :D

just 2 cents


aster
Thu Apr 20, 2017 8:18 pm
But a small catch is that you may need a uart dongle or st-link firsthand to flash that at 0x8000000

I thought i was able to flash the bmp software after the bootloader :?


ag123
Fri Apr 21, 2017 5:33 am
you can try that though, just that u’d need to build from source and
in your ld scripts, you would need to update the origin for flash so that it would offset away from 0x8000000 leaving room for the bootloader
e.g.
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
FLASH (rx) : ORIGIN = 0x08005000, LENGTH = 108K
...

Leave a Reply

Your email address will not be published. Required fields are marked *