Monday, April 30, 2007

Microcontroller Fun

The ARM7 microcontroller board as well my JTAG adapter arrived from Sparkfun over the weekend so I've spent the last few days doing a little tinkering. Although there aren't any official instructions for using the JTAG programmer provided by Olimex with the Fab@Home, I thought I would give it a try since their USB JTAG programmer is cheaper, and none of my computers have parallel ports (They're so 80's!) I've heard rumors that Rowley Crossworks 1.7beta supports this programmer, and I figured I would probably be able to minimally get it to program the board with an ELF file. Whether or not this was a wise choice is still to be determined.


The JTAG programmer from Olimex does come with a CD that is installs "ARM GCC for Dummies" to assist in programming ARM processors. Now, I am no dummy when it comes to GCC or programming, but I figured this tool was my best bet to start.

I installed the tools from the CD exactly as the instructions provided and proceeded to load up the Eclipse IDE. Their example "blinkie LED" project opened immediately, so I figured this would be a piece of cake. Imagine my surprise when the JTAG failed to program the microcontroller...

After spending about two hours meddling with different versions of GCC, changing linker settings, editing Windows Environmental variables, I began to wonder how anyone unfamiliar with programming tools, never mind GCC, would have ever been able to figure this all out. Once I finally got the JTAG to work and was able to step through a program, I deleted all the tools and started from scratch to find the right combination of tools to get everything up and running. The final solution (discovered through much experimentation!) is not so bad however.

These instructions will get you up and running in Windows if you are provided with the installer "OLIMEX-GCCFD-190207.EXE" If you have a more recent version, it may just well work out of the box.

1) Run installer from CD, install JRE if necessary
2) Plug in JTAG board, three times you will be asked for the location of the driver, which will be "C:\GCCFD\Olimex OpenOCD Driver" (Still following stock directions)
3) Get the latest version of OpenOCD and install
4) Open the Eclipse IDE from your desktop
5) Go to Run -> External Tools -> External Tools...
6) Click on "OpenOCD" in the left pane
7) Change the "Location:" to "C:\Program Files\openocd-2007re141\bin\openocd-ftd2xx.exe" or substitute your new release here
8) Repeat steps 6 and 7 for OpenOCD Tiny if you're using the USB-only JTAG programmer

Now you're ready to program and debug on your LPC2148. Simply click Run -> External Tools -> OpenOCD to connect via JTAG, then click the 'bug' to start debugging.

So I finally was able to step through the demo program, only to find that I didn't have any blinking LEDs. A quick scan of the source code showed that the program was trying to blink LEDs on P0.10 and P0.11. I now realized this program was written for the larger LPC2148 development board.


There is a Status LED provided on my board connected to P1.24 which I decided to use instead. This requires a few tweaks to the firmware code to work correctly. All the information you really need is provided on page 82 of the LPC2148 user manual.

The header file included is intended for LPC210X processors. Assuming you want to get a demo up and running quickly, add the following defines to lpc210x.h, preferable in the GPIO section:

#define IO1DIR (*((volatile unsigned long *) 0xE0028018))
#define IO1SET (*((volatile unsigned long *) 0xE0028014))
#define IO1CLR (*((volatile unsigned long *) 0xE002801C))

These are all the 2148-specific definitions we'll need. Now, just change the pin that gets toggled in main.c:

Initialize();

IO1DIR |= 0x01000000; // P1.24 output
IO1SET = 0x01000000;

// endless loop to toggle the LED
while (1) {

for (j = 0; j < 500000; j++)

IO1SET = 0x01000000;

for
(j = 0; j < 500000; j++) // wait 500 msec
IO1CLR = 0x01000000;
}


Being a slave to MS Visual Studio, the debugging shortcuts are engrained in my brain forever. After briefly changing the Eclipse shortcut preferences to mimic Visual Studio, I deployed the project to the LPC2148 board and got my blinking LED :) Sorry about the quality of the video, I really need to work on getting a camera with some better video capability.



Saturday, April 28, 2007

Construction Underway

I've finally had a chance to get to work on construction of my fabber. The Fab@Home Model 1 is supposed to take 18-20 hours to build. After a few hours myself, I am convinced that at least half of that time is spent peeling the contact paper off of the acrylic. This task is a lot harder than it looks. No matter how fast or slow you go, it takes a long time to peel off all of the paper.

Peeling the paper quickly:
Peeling the paper slowly:


And all of this peeling has resulted in what I like to call "peeling fingernails," which look a little something like this:


Ouch!

The threaded inserts melt very easily into the chassis with my gas soldering iron which was a pleasant surprise.


Here is a photo of my fabber as it is now. All I need to do is mount some of the limit switches and the chassis construction will be complete.


In addition, Evan Malone recently posted to the Fab@Home forums that "Fabbers in progress" could be put onto the "Fabbers of the World" page on the Fab@Home website. I added my project to the bottom of the page, so I guess there's no turning back now!

Tuesday, April 24, 2007

Acrylic Arrives









After much patient waiting, the laser cut acrylic pieces have arrived! Now that I have the acrylic in hand, I can start putting together the fabber.

I have to admit I was a bit scared when I first opened the package. All I could see around the edges of the layers of packed acrylic was yellow. I was a bit nervous that perhaps they forgot to cut out the syringe holder pieces in red for me. After going through layer by layer, I found all the pieces to be correct.

There's a photo for each layer as the acrylic was packed. You'll notice it was all packed very well and nothing broke. I also tried to take the photos at an angle on the layers that have some red pieces, since the contact paper covers make it hard to see what color the acrylic is.

Friday, April 20, 2007

Parts Update

I've been in touch with Koba Industries and I'm happy to report I'll be receiving my acrylic parts very early next week. Once it arrives I'll be able to start really building my fabber.

In the meantime, I was looking for a few ways to reduce the cost of some of the parts. I recently bought some light bulbs at Lowe's for my apartment and had "won" a $10 gift card. So last night I ventured to Lowe's to see if there were any parts I could buy at Lowe's that would work in my fabber. I used to have a whole collection of various sizes of heat shrink tubing but I used to be pretty disorganized with all my electronics junk so I'm not sure where it all is. Lowe's has some really good prices on heat shrink, and I also managed to find the 4" cable ties there. Overall, these parts from Lowe's cost $10, but from Digikey they would have been about $14. With my giftcard, I got them for free.


In other news, my limit switches from Digikey also arrived. These components aren't as important as the acrylic, but at least one is needed to complete construction of the base of the fabber, so I ordered them right away.



I've also been thinking about possibly designing a PCB that I can mount the microcontroller board directly onto, that will have a header that goes directly to the stepper motor amplifier board. I'm expecting my microcontroller board to arrive in the mail early next week as well, but looking at the pictures, I can see that they didn't leave a spot or drill a hole for a mounting screw. This would mean the board would be held on only by the friction of the headers. This may or may not work, but there would always be the option of using ribbon cables to the PCB as well.

If I decide to have a PCB manufactured instead of using the "breakout board," when I finally test the board, I'll post the Gerber and drill files onto the Fab@Home wiki.

Monday, April 16, 2007

Parts Galore

A whole slew of parts arrived today from McMaster. I'm ready to begin construction as soon as my acrylic comes in from Koba. I'm pretty excited about getting started so hopefully I'll hear an update from them soon.

In an attempt to stay organized I labeled all the parts with the line number from the BOM with a marker. If you're building a Fab@Home as well, don't be too worried if your line numbers don't match up with the same parts I have here. When I printed out the BOM from Microsoft Excel the line numbers got all screwed up, and unfortunately I'm going by the wrong numbers. I think I've gotten it all figured out so this doesn't mess me up in the long run.

Friday, April 13, 2007

First Parts Arrived

Two parts from SDP-SI arrived today. It's not much, but it's a start. They also sent me a free branded keychain knife. The other two components from SDP-SI are backordered, and there is no ETA, but they're going to ship them once they're in stock. I'll have to wait until next week before anything else comes in.

I'm tracking my orders from McMaster and Digikey, but I haven't heard from Koba. My online order status just says "Ordered." I'll give a week before I ping them to see how my acrylic is coming.

Wednesday, April 11, 2007

Ordering Parts: Round 1

Since I'm building my fabber over a period of two to three months I'm not ordering all my parts at once. I made a list of the parts I would need to minimally complete the construction of the "Machine Base" which should keep my busy for a few weeks. It will probably be a week before these parts arrive anyways.

To save on shipping costs, it would have been ideal to order all parts from the vendors I needed to order from, but it just didn't work out that way this time around. Here's who I ordered from:

Koba Industries: I have to give props to Kenji Kondo at Koba, he answered my questions about ordering custom laser-cut acrylic in record time! My yellow and red acrylic is being cut as I type (hopefully.)

McMaster-Carr: These guys deserve some props too. Their AJAX-enabled online catalog is top-notch; fast and very detailed. Unfortunately, I wasn't able to order all the parts I needed from McMaster, but it'll be a pleasure to check out their website again.

SDP-SI: I only needed three out of the four parts from this vendor, but to save on shipping I ordered all four parts. I was a little disappointed that two parts were backordered, specifically the timing pulleys and the timing belt. I elected for them to ship the parts they had in stock immediately, and the others when they arrived. The shipping costs were about a fifth of what I expected, so I wasn't too worried. These vendors must ship so much stuff that they get one heck of a discount with UPS!

Digikey: Only ordered the limit switches from them. I'll be back for another order in a few weeks.

Well I guess my local UPS and FedEx guys will be stopping by a few times soon. Until these parts arrive, I'm not sure if I'll have too many updates.