STM32, Maple and Maple mini port to IDE 1.5.x

Note: Please make reference to:

For a summarized version of pertinent information contained in this lengthly
thread. Also, some simple Mini Maple projects with source may be found on
my blog: http://www.hackster.io/rayburne

its worth to give this another try on a maple clone because its a shame to use that usb jack for power only.

Device Manager showing the two USB modes of the Maple Mini: Serial / DFU:

From my experience it is not a perfect solution, but most of the time if serial is enumerated, the DTR line will reset the bootloader into DFU... maybe 9 out of 10 times. If I put the Mini in DFU mode, the success rate is 100%. Again, this is on par or better than my Pro Micro boards.

I found it very interesting that the DFU mode has a HID descriptor ... sounds like something to look into.

Ray

which one does mapleloader.jar use? or does it depend on both?

i think the drive letter thing may have caused some trouble last time too. notice the batch file i posted earlier simply leaves out the drive letter so default partition is used and it works perfectly. is it absolutely necessary to use a letter for arduino ide? or maybe something like ../ works?

setting environment variables is a huge pain in gcc, eclipse, and other toolsets. that was one big advantages of arduino.

Note: Please make reference to:

For a summarized version of pertinent information contained in this lengthly
thread. Also, some simple Mini Maple projects with source may be found on
my blog: http://www.hackster.io/rayburne

rogerClark:
No. I'd not seen that link.

I agree that it would be easier just to make a whole hardware folder.
<...>

Also stumbled across this while looking: openstm32sw/stm32f4 at master · gbulmer/openstm32sw · GitHub

I went back 20 pages in this thread to see if I could find that link and did not, my apologies if it has already been identified.

Ray

Note: Please make reference to:

For a summarized version of pertinent information contained in this lengthly
thread. Also, some simple Mini Maple projects with source may be found on
my blog: http://www.hackster.io/rayburne

john1993:
which one does mapleloader.jar use? or does it depend on both?

i think the drive letter thing may have caused some trouble last time too. notice the batch file i posted earlier simply leaves out the drive letter so default partition is used and it works perfectly. is it absolutely necessary to use a letter for arduino ide? or maybe something like ../ works?

setting environment variables is a huge pain in gcc, eclipse, and other toolsets. that was one big advantages of arduino.

the script maple_upload.bat contains the command:

java -jar maple_loader.jar %1 %2 %3 %4 %5 %6 %7 %8 %9

the script serial_upload.bat invokes this:

stm32flash -g 0x8000000 -b 230400 -w %str% %1

is it absolutely necessary to use a letter for arduino ide?

I have a dual partition system, so for me, yes it is necessary. For those with only one partition, I have no idea but suspect relative paths will work except with AVRDUDE... this may have been fixed, but once upon a time the drive letter could NOT be used...
Reference:http://savannah.nongnu.org/bugs/index.php Bug report #39230

setting environment variables is a huge pain in gcc, eclipse, and other toolsets. that was one big advantages of arduino.

For GUI environments, yes. For commandline tools, should be as easy as:

Environment.cmd

path=%path%;C:\Program Files (x86)\Arduino_106\hardware\tools\avr\bin;
CMD /K "PROMPT $G &&CLS&&PATH"

This will give you a shell with a modified set of environmentals that last only for the duration of the window! Neat ugh? Of course, you can do some SET vars as required.

Ray

i guess it was rogers warning about changing the drive letter in that bat file that concerned me. imo the fewer things to "set" the better.

mrburnette:
DTR line will reset the bootloader into DFU... maybe 9 out of 10 times. If I put the Mini in DFU mode, the success rate is 100%.

one last question. are you saying that you must put into dfu mode manually to get reliable loading? must one still press buttons with that method? or am i misunderstanding again.

Note: Please make reference to:

For a summarized version of pertinent information contained in this lengthly
thread. Also, some simple Mini Maple projects with source may be found on
my blog: http://www.hackster.io/rayburne

one last question. are you saying that you must put into dfu mode manually to get reliable loading? or am i misunderstanding again.

From my experience, for some crazy reason, even with the COMx port shown enumerated... sometimes, maybe 1 out of 10, the attempt to download a sketch will not work... an error message is displayed about not finding the board.

So if reliable means 100% of the time, then placing the mini into DFU always works... from the GUI point of view, the DTR is still plused and the download script then goes into DFU and the uC is already there.

But, I have seen the same behavior on Pro Micros with USB based on LUFA. Maybe it is a Windows only problem - I simply do not know. But, since I am aware of this, 9 out of 10 perfect downloads is not bad.

Ray

mrburnette:
9 out of 10 perfect downloads is not bad.

for you maybe. out of more than couple thousand downloads now here not a single case of failure or having to push a button. if roger and others are having the same problem then its back to serial/stm32flash.exe and swd/stlink_cli for me. NO MAPLE/DFU ALLOWED! lol.

Note: Please make reference to:

For a summarized version of pertinent information contained in this lengthly
thread. Also, some simple Mini Maple projects with source may be found on
my blog: http://www.hackster.io/rayburne

9 out of 10 perfect downloads is not bad.

Well, you have to admit that it is far better than Meatloaf's song which states:

'Cause two out of three ain't bad
Don't be sad
'Cause two out of three ain't bad

Again, the MCSE in me is suggesting it is a Windows issue... likely a time-out on the serial when the uC is busy and not servicing the USB... as I stated, when it happens, I have pre-checked the COM port and it is enumerated but the Maple is not found. A reset or just setting DFU mode corrects the issue and the next download (serial or USB) is successful. It is probably as easy as instructing the students to always press Reset, wait 10 seconds for the PC to beep twice, and then downloading. Maybe it is, maybe it is not. I understand your concern when students gets their hands on these boards and are following a printed lab exercise.

Ray

or worse working assignments at home with no gurus around to bail them out. out of 4 people on this end 2 had similar flaky results and the others failed to get it working at all. fortunately we have a couple alternatives, serial and swd, that are 100% with no need to push buttons.

speaking of which roger asked for some links to a couple other serial utilities ive have same good luck with:

really no more than curiosity since the stm32flash.exe in the batch file seems to be doing the job ok now. nice to have so many options though.

Guys

It's interesting about the maple mini clones not being a direct clone, but more of an interpretation of the maple mini design.

@john1993

You are correct about why the "minimum development boards" not working for DFU upload.
Its because they don't have the 2 transistors that the maple mini board have, which are connected to the USB lines.
As far as I can work out, they are used for force the PC to re enumerate, when the maple switches from being USB to DFU device and vice versa.

I did try loading the maple mini boot bin file onto my non maple board, but could not even get it into perpetual DFU mode.

However I find the Maple mini board DFU upload fairly reliable, and if it fails to enter DFU, you can force it, by pressing the "button" just after it boots, and it then enters perpetual DFU mode.

The main reason Im not using the Maple mini board all the time, as that on Windows 7, I have to press F8 at just the right moment to get that startup menu, and as my machine multi boots into various OSs this makes the process even harder and sometimes I don't manage to press F8 at the right moment.

Re: F4

I agree regarding the F103 being the best value. I.e Due class performance, for perhaps 1/10 of the price, depending on where you get them from.

If you want more ram and flash, the Due is probably a better option, than the F4 at the moment.

The only reason to go for the F4 is if you need the extra speed, I.e up to 180mhz, which is quite a niche area, as you are getting into the realms of the RPi, etc, and the RPi probably ends up being cheaper.

If some of the Chinese manufacturers start making cheaper F4 boards, this could change, but at the moment I can't see many F4 based boards except for the ST Discovery line.

There are Chinese made, Maple, class boards. I have a 103RCT board, but again, I'm not sure it's worth spending much time supporting them, because the price of these e.g $15 being 3 times more than the Maple Mini clone, makes them look quite poor value.

So stock up on Maple Minis, as they appear to be exceptional value !

Re:f4 differences

There are quite a lot of differences, between the F4 and the F1. The memory map is different e.g for all the hardware registers. And the GPIO controls are different, but I think the Serial and other things are fairly similar, so I think it's something that I will get working sometime in the next month or two.

rogerClark:
I did try loading the maple mini boot bin file onto my non maple board, but could not even get it into perpetual DFU mode.

However I find the Maple mini board DFU upload fairly reliable, and if it fails to enter DFU, you can force it, by pressing the "button" just after it boots, and it then enters perpetual DFU mode.

The main reason Im not using the Maple mini board all the time, as that on Windows 7, I have to press F8 at just the right moment to get that startup menu,

further confirmation that problems are common and not unique to setups on my end. that usb jack staring back is enticing but compared to the ease and reliability of other download methods sounds like still a no-go for me. pushing buttons and hitting os keys doesnt sound attractive after being spoiled by just needing to click on that wonderful turquoise arrow. specially considering how often it gets clicked.

as far as f4 it would be great to see that integrated into the project but its pretty much just me at this end. most of the other potential users here cant afford to spring for more than the cheapo maple units.

i havent managed to replicate all of mrburnettes results yet but working on it. still amazing how far weve come in such a short time.

Hi @ALL

I have a small example of improvement display information about program storage space usage and dynamic memory usage for global variables.

It need to change the file platform.txt like that:

## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
#recipe.size.regex=\.text\s+([0-9]+).*
recipe.size.regex=^(?:\.text|\.rodata|\.ARM.exidx)\s+([0-9]+).*
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*
Sketch uses 11,364 bytes (10%) of program storage space. Maximum is 108,000 bytes.
Global variables use 3,136 bytes of dynamic memory.

Hi Roger!
I have a grief. I lost a bootloader. Could you know how to flash a bootloader using STM32F4 Discovery (in ST-Link V2 mode)?

Hi Alexey

Which bootloader are you trying to flash ?

A bootloader in the STM32F4? on the discovery board.

I didnt think the F4 discovery board had a bootloader in the F4 its self, I thought that the ST Link was handled by the STM32F103 on the board, which acts as the STLink.

Do you mean you have erased the code on the STM32F103 STLink on the STM32F4 Discovery board ?

Do you have a USB to Serial adaptor?

You should be able to program the F4 using that, as you can access USart1 (PA9 and PA10) and Boot0 and Boot1

However if you have erased the STM32F103 StLink it is probably more difficult

Which STM32F4 discovery board do you have?

Alexey

Thanks

I will update my local copy and if it works OK, I'll upload to my repo

## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
#recipe.size.regex=\.text\s+([0-9]+).*
recipe.size.regex=^(?:\.text|\.rodata|\.ARM.exidx)\s+([0-9]+).*
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*

BTW.

Sorry I have not used your new code for digitalWrite yet.

I have been very busy on other projects ESP8266 for an IoT device has taken a lot of time, because there isn't much documentation for the IoT SDK for esp8266 and there isnt a good forum.
Well there is esp8266.com but most of the time I don't get any answers to my questions.

Perhaps there is a better forum, but even the official Espressif forum where you need to sign a Non Disclosure agreement, is not very active.

I really like the ESP8266, but I wish there was more information. e.g. I'd like to use SPI in slave mode, but there is no information about how to do this.

I need to flash a maple bootloader to maple-mini R2. I have not USB to Serial adaptor. But I have STM32F4Discovery with SWD Connector and ST-LINK mode jumpers.

Hi Alexey

I'm not exactly sure how to do this.

If you remove the 2 links that connect the STM32F103 to the STM32F4xx and then take a wire from one side of each of the links to the Maple board I guess it should work.

Did you see this link

http://www.rowetel.com/blog/?p=3168

BTW. Boot1 on the Maple mini is floating, you probably need to pull this to ground.

On Maple mini (see Maple | LeafLabs)

PA13 is D22 SWDIO
PA14 is D21 SWCLK

Do you have a Uno similar Arduino with DIL Atmega328

I think it would be easier to remove the ATMega826 and use the board as USB to Serial

(again don't forget to make boot1 to GND in this case as well)

BTW. F4 schematic may be

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/DM00039084.pdf

but it probably depends which F4 board you have

However I think that Serial upload is probably the best option if you can somehow make a USB to Serial device.

Do you have more than one Maple mini, perhaps you could write a simple program to use SerialUSB and output on Hardware serial

Anyway, good luck :wink:

Edit.

Btw

Even for stlink the stm32f103 needs to be reset with boot0 high , so you must press and hold the button, the reset the maple mini
Otherwise st link does not work

Yes, I have one more maple mini board, arduino nano and arduino diecimila with X3 connector http://make.kosakalab.com/arduino/bootloader/index_en.html

but I did not have enough knowledge to make of all this serial programmer

Hi Alexy

On you Diecimila board, remove the ATMega chip from its stocked.

Connect the maple mini rx (pin D0) to the pin labeled tx1 on the maple mini
Tx (D1) from the Diecimila goes to rx1 on the maple mini

You can probably power the maple mini from 5v from the Diecimila board

Pull boot1 to GND

Reset while holding the button down,

Use st flash uploader windows program

Note. If the program does not connect, reset the maple and try again

Hi

I have some trouble with menu realisation. I think that is the bug/issue Arduino IDE 1.5.8

Can any correct English write about this problem/issue there?

And Ask the question there "how to make sub-menu"

Thank you all!

Hi Alexey

I looked at your issue on GitHub and it looked fine to me. Your English is good.