Sunday, May 24, 2009

Bringing up Baby: (a new-to-me) Cortex-M3 board

First sign of life from my Cortex-M3 processor board

24 May 2009

After some struggles with stupid errors, I finally got a sign of life from my little Cortex M3 (a fairly new ARM processor) board (ET-STAMP-STM32, purchased from   
FYI, here's where I ordered the board from:
US$ 24.90 (+shipping)  

So, it's around the same price as an Arduino, but much more CPU firepower. memory and better I/O (including 16 channels of 12-bit AtoD and two ch of DtoA – real D2A, not just PWM {which it also has plenty of.})   This is why several reprappers are working with this chip.  (NXP says they'll have a similar chip out, the LCP17xx "real soon now," but I haven't seen it orderable andywhere.)

The futurlec folks don't get parts to you nearly as fast as digikey (took a couple weeks), but their prices are good, and they had this goodie in stock when I ordered it (and Sparkfun was out of their Cortex boards; though they've now got some in.)

This board's .pdf manual (English translation from Thai), isn't perfectly clear, but is OK after some study. Certainly better than my (nonexistent) Thai, so I shouldn't complain.

They don't include (or describe) how to set up a compiler toolchain, but that info seems to be available online. I followed the steps outlined in:

except that I downloaded the code to my board using UART1 on the board, and the two boot lines to invoke the serial downloader.

See also, “A Free Toolchain for ST-ARM uC” online (as of 5/2009) at:


First problem:

I ,finally> found that my first jury-rigged +5 supply (tapped off of an Arduino clone) was misbehaving (slight overvoltage, strange --- looks like a solder joint came loose on the regulator), so I rigged up a separate 7805 and a wall wart, ditto a 3.3 v regulator for the STM32.

(We're in the middle of a remodeling project, and I'm working on a folding table in my bedroom, instead of my usual electronic-ing benches in the basement – that's all torn up/boxed up during construction. And my bench supply is hiding in some box. (Mistake!)

Problem 2:  Needs true RS232 levels (not TTL levels)

My best guess is that Desktop PCs, that still have a serial port, are the norm where this board is built (Thailand.)  As a result, it expects true RS232 levels, and comes with a DB9 cable.   As a result, I ended up creating a four-step Rube Goldberg interface to get it to talks to my (serial-portless) laptop:

  • My Laptop (USB port)  

  • FTDI USB to serial cable (at 5V TTL levels)

  • MAX233 on my protoboard (5V ttl to RS232 level transceiver)

  • On-the-board RS232 to 3.3V ttl level translator (can't read the P/N, suspect MAX3232)

  • STM32's UART1

I wish the designers of this module had put in a jumper between their level translator and the processor pins. (I have another FTDI based device that can be switched to do either 3.3 V or 5 V TTL levels, the USB BUB board from -- BTW, this costs less than a FTDI cable, and IMHO more versatile, e.g. the voltage level jumper-ability.) Since board is surface mount, I was leery of attempting surgery, so I protoboarded the above hack to get it talking.

There are two hardware items that need to be set correctly for the CPU to respond to the STM Flash Loader:

  • The boot0 pushbutton must be depressed (not crystal clear in the manual.)  

  • The jumper to the right of the pushbutton should be on the outermost two pins (position marked ISP.)

With that, I now get signs of life (target is readable!), when I push the reset switch, WOOT:

 Look at all that memory -- half a meg of flash, and 64K of ram.  Not too shabby!

Getting a blink program running:

I adapted the (great) example from

The main difference is that that example assumes the use of JTAG, which my board lacks.  (And I don't have a JTAG probe yet, either.)

Following those instructions, I downloaded the latest GCC toolchain for the Cortex, from

I selected current (2009q1 release) as of this writing, IA32 Windows Installer.

I also grabbed new download of cygwin (linux like env. for windows), from: 
and set that up

I was able to use the example .c and linker-script files verbatim (always helpful when trying something new), and jumpered/protoboarded an LED/resistor onto portB/pin9.

The example was especially helpful to me, because it gave exact “what to type to Cygwin's bash shell” lines, complete with all the options needed to compile, link, convert to a plain binary file to download to the STM32 chip.  The end result was a plain binary file (in may case blink_flash.bin), which is just what the serial bootloader wants.

One thing that wasn't quite clear to me was whether to leave my code .org'ed at 0x000000, or relocate it to 0x8000000. The STM documentation isn't crystal clear on how the FLASH is addressed in the various boot modes. I think it's addressable as either address when the boot1/boot0 are both set to zero (but I won't swear to that.)

In any case, the .bin file downloaded without error: 


For this little board, the magic configuration info is the following:

Leave the boot1 jumper in the ISP position always.

The boot0 switch (to the left of the boot1 jumper: should be:

  • Depressed during code dowload (which lights the green LED)

  • Out to execute the code from FLASH (green light off)

Once the code has been downloaded (using STM's flash loader demonstrator {v 1.1}), pop the boot0 switch out, and either press the reset button, or power cycle the board.

A blinking LED! 
It doesn't take that much to make me happy.

Now, on to studying the myriad I/O configuration registers.....

I'd take a photo of my messy (but working!) protoboard, but my camera seems to be hiding. 
But it is blinking.

More later (and fingers crossed that I can find the camera amid all our remodelling chaos),


Sunday, April 26, 2009

Impressions of the Cupcake CNC, 26 April 2009

Greetings all,

I (unexpectedly) got to see a cupcake CNC fabber yesterday at the Microsoft Startup Labs near MIT.  This was part of  
(I had prior commitments yesterday, but some luck with logistics, and that enabled me to catch 
the last 90 minutes of this event.) Following are my impressions of this device, 
please forgive the choppy grammar/stream of consciousness style.  
It's warm enough here that I'm functioning at only a low level, 
and thinking of crawling into my glass of cold soda to cool off....  
(I'm also apparently having a disagreement with this editor about where/if lines are wrapped.
It's sure not wrapping in any way I like/understand.... Grrrr)

They (Bre P. and Zach H.) were printing ABS, but they say it prints HDPE and PLA as well.

Small size
form factor roughly that of the original "tombstone" MacIntosh computers, 
for those old enough to remember those. Maybe a bit smaller.

The outer structure is built from thin (6 mm or 1/4" inch) plywood, cut via laser.  
Attachment used a combination of tabs/slots and threaded 
fasteners. The box structure, even with large cutouts in the faces, 
gives a nice sturdy structure, since the walls resist shear/racking.

Some of the smaller structural pieces were 1/8" plywood. (I think it cuts faster via laser, and it cheap.)

Some pieces (exp. the portion that moved up/down) are made of laser-cut, clear acrylic.  
This is nice, because one can see the inner working of the extruder 
(e.g. see how fast the filament is being consumed.)

The cupcake uses metric threaded fasteners, rods and bearings.  
(I was anticipating use of imperial sizes from designers in the US.)

The power supply is housed in the base of the unit (below the build bed), and the electronics are all mounted 
onto the device, mainly on the outer back wall. So, it's a single "brick" 
and was pretty easy for them to break down and pack it up. I presume that setup was similarly quick, 
but I didn't see that.

[IMHO, calling this CNC is a slight misnomer, because CNC usually implies conventional machining, 
at least to me. But I suppose they can't use FDM (R), due to the trademark on that term, 
from what I understand from past traffic on the reprap forums. This is a nit/pet peeve]

X and Y used belt drives. Z used a combination of belts driving threaded rods.  
The extruder used a gear motor for the pinch-wheel design.

Fast motions, ballpark of 40 mm/sec, maybe even faster. Similarly fast accelerations; 
it really whipped through printing the raft for the polyhedron.

Smooth motion, using dual rods (and some sort of plastic bushings) as slideways, 
along with some (obligatory) skate bearings. The size 17 steppers didn't seem to be taxed, 
and the gen-3 (surface-mount) stepper driver chips
were warm to the touch, but not hot.

Fine (0.5 mm or under?) extrusion -- made finer by moving (the nozzle) faster than the melt came out, 
stretching it and thus reducing the diameter of the melted plastic being extruded.

I watched it print a little polyhedron (with a waffle pattern internally to reduce plastic volume 
and speed the printing. The print quality was quite good (though I haven't seen many printed objects 
to compare with.)

The build volume is small (100 mm cube AFAIK);  IMHO, this might be better with one longer horizontal axis, as is usually done for machine tools such as mills or lathes.  Apparently the cupcake's build volume 
is constrained by the size pieces they can cut on the CNC laser cutter they have.

It has survived the "tender" attentions of the TSA, and they proudly showed me the TSA inspection certificate.  
[IMHO, this may have been an unwise tempting of fate, since they had a return trip ahead of them.  
Maybe they drove and the TSA document was from a prior trip.]

Walk-away operation. The machine worked well enough (and they were apparently confident enough) to walk away from it 
while it printed out the polyhedron. It printed the the part out with no user intervention, 
except setting the nozzle-bed height at the start of the print.  
The coil of ABS was lying on the coffee table beside it, slowly being drawn up and into the pinch-wheel extruder.

They used skeinforge to slice .stl representations of objects, and replicatorG to drive the machine. 
I don't know what version of the Gcode firmware they were using, but it seemed to behave well.

Printed parts
I saw gears, a pulley, an airfoil section, and a pair of tweezers, printed previously.  
Apparently, they had forgotten to bring tweezers (to remove the first blobby bit of extrudate) from the build bed, 
when the extruder was warming up, so they printed themselves a pair, thus avoiding further singed fingers 
-- quite handy. got to take the tweezers home; thanks guys!
(Why are they called a pair? They're actually less of a pair than a pair of scissors....)  
The gears meshed pretty well (not as good as hobbed metal gears, but not too bad, either.)
I don't know how well they hold up in use.

The view from the Microsoft Startups Lab, on the 11th floor of a building on the bank of the Charles river is 
*gorgeous* -- especially watching the sailboats and rowing sculls out on the river!  
Again thanks to the MS folks for making this venue available for the makerrevolution event!  

There were a number of other exhibits and activities, but I got their late, 
and focused my attention on the cupcake.  
My apologies to the people who brought lots of other cool projects.  
I wish I'd been able to get there earlier to check those out.

Zach, Bre or anybody else who was there, please free to comment/correct on what I've written.

Seeing this small, simple machine working, and working well has me re-thinking my repStrap game plan.  
There is something to be said for modest goals (printing small parts, without self-replication), 
as opposed to a more ambitious machine -- one that's not yet finished 
(translation: my much of sub-assemblies down in the basement, that can't yet print anything.)  
I'll have to sleep on this, and decide whether to change course on Cerberus, 
or perhaps divert and build a pre-cerberus machine as a first step.

-- Larry

Sunday, January 4, 2009

Hot Stuff! First Extrusion with New Extruder Design.

It's very late, but I have to put *something* up, because I just extruded my first plastic!

Not only that, I did so using a new design for my extruder's "hot zone." The design uses an Aluminum heater barrel, with inside-out nozzle inserts (made of brass.) The melted-plastic zone is under an inch long. The stem is stainless steel, with a reduced cross section just above the (threaded) junction of Al/Stainless, to confine the heat to the hot zone.

Above: Exploded view of the key parts of my extruder's "hot zone." The melt zone is deliberately kept short, and the heat is confined by the stainless steel stem, and its reduced cross section, just upstream of where it mates with the Aluminum barrel. The coarse threads on the barrel are to accept the nichrome wire.

Above: Here is the hot-zone assembly, after adding the nichrome and coating it with my DIY ceramic glue. It's not as clean looking as I'd like, but it seems OK mechanically and electrically. Aesthetics will have to wait for awhile....

But here's the real news (drum roll please.....):

Above: First extrusion with my new extruder design.
I fed the ABS welding rod by hand, and controlled the temperature (open loop) by varying the PWM duty cycle, while monitoring the thermistor resistance with a DVM (to the left of the extruder.) The temperature is approx. 200 deg. C. Note that the barrel is not yet insulated, except by the thin coating of ceramic glue.

Above: With some ceramic-fiber blanket to insulate the heater barrel, I can get to higher temperatures, and extrude HDPE. Based on the thermistor's resistance (visible via the DMM), the temperature here was ~245 deg. C. The PWM was set to 150; so the duty cycle was 150/255 or ~59%

Above: A (very, perhaps too) candid photo of my "highly organized" electronics workbench in my basement. I could clean it up, but I'd rather work on my repstrap!
The alert viewer may discern the beginnings of Cerberus' horizontal mechanism (left-hand side of the photo), based on a compound (X, Y) table, fitted with two stepper motors. More about that later.

That's all for now. I may add more photos and details later.
Next step should be closed-loop temperature control, based on the thermistor reading.