Go Down

Topic: STM32, Maple and Maple mini port to IDE 1.5.x (Read 629602 times) previous topic - next topic

john1993

#1095
Jan 10, 2015, 04:09 am Last Edit: Jan 10, 2015, 04:51 am by john1993 Reason: more help for the search challenged
john1993 and I have exchanged thoughts and his specific needs is in the area of academia where 95% is simply not good enough.


I think john1993 is simply summarizing his pleasure and displeasure with the state of things
95% pleasure. at least!

and i do agree theres less need to deal with these things here and now for reasons mentioned. bigger fish to catch.

i also agree searching threads like this is an onerous task. i know because ive been asked to do it several times so far. i should have saved the dozen or so relevant posts in favorites. whats that they say about hindsight?

quickest route to success is probably google "stm32 ghetto". in first couple hits all the relevant posts and links  are covered. the first page of the dollar thread maybe most useful. a little later in the search direct links to the same info reiterated in this arduino forum.




edit:

from page one.

Quote
I've attached a new batch file (A.BAT) that not only compiles but can flash the chip and then run the program all with a single key. No need to touch the target board at all anymore. This has major productivity advantages compared to the popular GUI/IDE approach. One requirement is that the STM flash demo utility be installed in a root folder called "STMFLASH". Note that you now need to connect DTR from the USB/serial dongle to pin 7 (nrst)
thats the quote and i hope the right batch file is attached below here. there were a couple different ones for the other stm utilities used there all of which have dtr capability.


rogerClark

@john1993

Do you have Boot0 pulled high all the time ?

As far as I can tell all that is happening is that DTR is being used to reset the device so that it goes into serial bootloader mode.

So if you want to run the program, standalone you would need to connect jump-link Boot0 LOW again?

Freelance developer and IT consultant
www.rogerclark.net

john1993

yes, you have now described the situation perfectly.

turns out there is no need to keep toggling boot0. no need at all to ground during development. for stand alone there is no need to ever bring it high. you will notice in the eevblog thread it started out with a switch attached then described as hardwired later on.

bobcousins

@john1993

Do you have Boot0 pulled high all the time ?

As far as I can tell all that is happening is that DTR is being used to reset the device so that it goes into serial bootloader mode.

So if you want to run the program, standalone you would need to connect jump-link Boot0 LOW again?
Yes, I was wondering about that. But maybe the ROM bootloader times out if it doesn't see the sync character and proceeds to execute user software.

I think that USB is something that promised a lot but the execution on Windows is quite screwed up. The Linux implementation is much better.

I think the other bootloader I mentioned is the one for the Matchbox-ARM, which implements a mass storage driver, so to program it you copy the .hex file to the USB device. It needs buttons to get into MSD though, it also lacks a "program on eject" feature, so would need a little work. MatchboxARM

The "best" solution seems to be a stock USB-serial chip. This saves all the hassle with switching device classes, special drivers, driver signing, obtaining VIDs etc. It is cheap and accessible for hobbyists.

Some of the chips provide both DTR and RTS, so there are potential two control lines available. Most chips provide DTR or RTS, although not all breakouts provide them.
Please ask questions in the forum so everyone can benefit. PM me for paid work.

john1993

rts has proven unusable under windows by the avr arduino crowd. that is another reason the oddball dongles seem flaky to some. i also agree an ftdi chip (actually silabs if you are smart) is the best solution for those infatuated with that usb jack. not for me though as this doubles the cost over the maple mini clones.

btw there is no timeout in the stm bootloader. as mentioned in page one on the eevblog site it waits forever for that start character.


bobcousins

yes, you have now described the situation perfectly.

turns out there is no need to keep toggling boot0. no need at all to ground during development. for stand alone there is no need to ever bring it high. you will notice in the eevblog thread it started out with a switch attached then described as hardwired later on.
Ok, so what you are saying is that in "development" mode, i.e. with USB-serial programmer attached, BOOT0 is always set high. Any reset will enter the ROM bootloader, and DTR is connected to RESET pin.

When you have finished development, (the USB-serial can be detached or just used for regular comms), BOOT0 is set low. Then any reset will start user code.

So it seems like a jumper or switch on BOOT0 is required in that case. A fully automatic method would need an extra line such as RTS.

I have a cheap FTDI breakout FT232RL which is similar to Sparkfun/Adafruit ones at 10x price. It has DTR/RTS available on side connections, but only DTR on the end connector. (See pic)

The other cheap chips (CH340, PL2303) don't seem to have full modem signals available. The FT232RL is <£3 and available from local distributors.

There are some cheaper FTDI chips (e.g. FT230X) which have 4 configurable IO lines, which could be used for custom purposes, but it would mean using the special FTDI drivers instead of the stock UART/COM port API.
Please ask questions in the forum so everyone can benefit. PM me for paid work.

john1993

#1101
Jan 10, 2015, 01:33 pm Last Edit: Jan 10, 2015, 02:00 pm by john1993 Reason: maple not ample, gotta watch that speling
in most cases there is no need for 2 handshakes. nor really for pushbutton, switch, jumper, or even bringing that pin out at all.

everybody seems to go through the same evolutionary steps with these stm103 parts. for some it takes months. for others who were lucky enough to stumble on good info only a few days . i started out pushing buttons all day like everybody else then realized this was a huge waste of time and effort so moved on to the switch method recommended on the other site. then was convinced that a jumper and finally just permanently shorting the pads on development boards.

now out of hundreds (no exaggeration) of these maple mini clones passed through my hands a couple are wired one way and the rest the other. those with only 2 or 3 may take a little longer to decide how this works or just keep it stock if button pushing floats your boat.

similarly anybody who pays attention to good advice on the subject of usbserial dongles will have an easy life. using the lowest cost ebay silabs clones i linked early in this thread with latest drivers can expect 100% success (at least 100.000% to be technically correct). those preferring to gamble with old drivers and $15 sparkfun, 430, actual ftdi, prolific, etc may or may not get there.

i say this having over the last 10 years sent out thousands as part of the day job and a few hundred school related and keeping careful track of the troublemakers.


bobcousins

#1102
Jan 10, 2015, 04:39 pm Last Edit: Jan 10, 2015, 04:48 pm by bobcousins
Re; stm32flash

Made some progress!

I downloaded the latest stm32flash from https://gitorious.org/stm32flash

To build on Windows I installed MinGW https://sourceforge.net/projects/mingw/. Also installed a patch to fix a problem with "Please insert disk" error, Issue 2108

stm32flash supports toggling of DTR and RTS in windows, although as usual on Windows it's not perfectly straightforward! The user program can control the state of DTR/RTS, but there are default states for when the COM is opened/closed.

Using my FTDI breakout, I managed to get stm32flash to toggle DTR, and set RTS low before starting the download with
Code: [Select]
stm32flash.exe  -i dtr,rts,-dtr: \\.\COM21
So we could control RESET and BOOT0 appropriately.

I was looking at the Silicon Labs USB serial chips, and the CP2102 has modem signals and is somewhat cheaper than FTDI chip, although it is 28 pin QFN (available from RS/Farnell). The CP2102 breakouts on ebay do not seem to have both DTR and RTS, only DTR.
Please ask questions in the forum so everyone can benefit. PM me for paid work.

john1993

congratulations. definitely a step in the right direction.

you might investigate the one wire dtr method as a better alternative to button pushing for most windows users. no special programming required and no rts which, unlike dtr, has been proven in this forum to be unpredictable with avr arduino. a simple batch file mod integrates into rogers setup with ease.

bobcousins

congratulations. definitely a step in the right direction.

you might investigate the one wire dtr method as a better alternative to button pushing for most windows users. no special programming required and no rts which, unlike dtr, has been proven in this forum to be unpredictable with avr arduino. a simple batch file mod integrates into rogers setup with ease.
I've no reason to believe that RTS is any more reliable than DTR, so I think I would have to say "citation needed" on that.

So far I've found a thread saying it is better to use RTS than DTR. And anyway, we are doing STM32, not AVR, so any problems with AVR may not be relevant.
Please ask questions in the forum so everyone can benefit. PM me for paid work.

john1993

#1105
Jan 10, 2015, 06:41 pm Last Edit: Jan 10, 2015, 06:55 pm by john1993
I've no reason to believe that RTS is any more reliable than DTR, so I think I would have to say "citation needed" on that.

So far I've found a thread saying it is better to use RTS than DTR. And anyway, we are doing STM32, not AVR, so any problems with AVR may not be relevant.
there are probably a few dozen "silent majority" who have spent much time lurking this forum who know exactly what im referring to. verified myself with personal experience. well documented and iirc also a part of the official arduino manuals.  schedule does not allow me to do research for you atm so ill just say "google is your friend" and leave that as an after class exercise.

the problem had nothing at all to do with avr or arduino but an issue with win api.

when the auto-load process was first introduced to me in the other site i also thought it could be improved upon. so embarked on a series of experiments similar to yours. even went further to hook up a rather weird series of transistor and passive hardware. it took me a while to realize that ready to go zero cost zero effort solution had little room for improvement. maybe you will have better luck. keep us tuned.

bobcousins

there are probably a few dozen "silent majority" who have spent much time lurking this forum who know exactly what im referring to. verified myself with personal experience. well documented and iirc also a part of the official arduino manuals.  schedule does not allow me to do research for you atm so ill just say "google is your friend" and leave that as an after class exercise.
So you can't provide any evidence for your claim. I thought that might be case.
Please ask questions in the forum so everyone can benefit. PM me for paid work.

mrburnette

#1107
Jan 10, 2015, 07:37 pm Last Edit: Jan 10, 2015, 07:39 pm by mrburnette
Just my 2 ¢ ...

All this dialog about the current state of the STM upload/reset is a non-problem, IMO.  jonh1993 and I had as number on back-n- forth dialogs until I realized his soapbox is 100% always working because he is supporting students where deviation in lab exercises is not permissible.  john1993 test group is his statistical sampling and while it is unlikely that bobcousins or I would achieve similar results, I cannot reject the findings for his microcosm ... It is what it is.

Now, when bobcousins designs and produces his board (if he chooses) the reset mechanics is for him to dictate.

But no one is going to change the $4.80 Baite design... That dish is baked (Baite'd) and being served.

I would hope this reset stuff will fade for a while as the F1 and F4 cores are much more important IMO.  Like Serial.parseFloat() does not function.


Ray

rogerClark

Ray

Sorry..

I thought I'd fixed parseFloat() ages ago.

I will take a look

Freelance developer and IT consultant
www.rogerclark.net

rogerClark

Bob

I found some cp2102 USB to serial adapters on ebay that breakout all the signals



http://www.ebay.com.au/itm/CP2102-Module-With-DTR-Pin-STC-Downloader-USB-to-TTL-500mA-Resettable-Fuse-Desig-/181616339294?pt=AU_B_I_Electrical_Test_Equipment&hash=item2a492d695e


I think I have a CP2102 board that only has DTR but I'm getting quite skilled at soldering very fine wire directly to Surface Mount ICs, so I will lookup the pin out and see if I can attach a wire to RTS on my bioard.



Also.

Can you post or email me the revised Exe or add it to your repo and do a pull request, could you also add your revised source to the your repo etc so that it also gets pulled

E.g. in tools/win/src/stm32flash.


Also

Can you elaborate on how you built under Windows, what IDE did you use e.g. Codeblocks or visual studio or something else, or did you just do it from the command line via Make etc

Freelance developer and IT consultant
www.rogerclark.net

Go Up