Fab@Home:Model 1 Firmware

From Fab @ Home

Jump to: navigation, search

Contents

Welcome to the Fab@Home Model 1 Firmware Page

The firmware is the software that runs on the LPC2148 microcontroller.

When you receive your microcontroller, it will have a simple demonstration firmware loaded onto it from the manufacturer. You will need to replace this with the Fab@Home firmware. There are several ways to put the firmware onto your microcontroller, all of which will require that you buy a programming adapter. The simplest method is to buy a JTAG cable for ARM processors (20 pin, 2 rows X 10 pins). Most ARM JTAG cables will work with CrossWorks so this is the recommended approach. See below for a list of recommended JTAG adapters.

An alternative method involves using the serial bootloader on the LPC-H2148 with a precompiled hex file, Philips serial programming software, and a serial/TTL UART adapter connecting your PC to UART0 on the LPC-H2148. See below for preliminary information on this approach.

Firmware Object Code Downloads

Beta Version

NOTE: This binary cannot (currently) be programmed on to the microcontroller using Rowley CrossWorks. In order to program this firmware, you will need to use a different method, such as OpenOCD.

Current Version

Legacy Version

WinARM Firmware Development Environment

Version 4 of the firmware was written in C and uses the WinARM toolset and ARMlib libraries which are available for free under GNU GPL.

Download WinARM

WinARM is available on Martin Thomas' website:

WinARM version 20060606 was used to write the version 4 firmware.

Download ARMlib

A slightly modified version of ARMlib (a few added defines, additional linker script, and fixed SPI registers) is available here:

The original ARMlib is available on Pascal Stang's website:ARMlib The ARMlib version released on November 06, 2006 was used to write the version 4 firmware.

Install WinARM and ARMlib

The basic development environment is now configured. The firmware can now be compiled using the standard make command in a console. The result of this command can be seen below:

Compiling in a console
Compiling in a console

While the console may be the preferred method for some, an IDE is recommended to simplify the process. Eclipse and Microsoft Visual c++ have both been used to sucessfully edit and compile software using WinARM. The IDE is the developer's choice, but Eclipse is recommended.

Eclipse Development Environment

Step 1: Download Eclipse IDE for C/C++ Developers. This includes all the necessary plugins to develop C/C++ applications. If you already have Eclipse installed you will only need to install the CDT, also available on the Eclipse website.

Step 2: Inside the Eclipse download is a folder called "eclipse". Extract this folder to any desired location in order to install Eclipse.

Step 3: Inside the "eclipse" folder, run eclipse.exe to start up Eclipse. The

Eclipse
Eclipse

Step 4: Select a workspace folder. This can be anywhere, but it is a good idea to select somewhere that is easily accessible.

The "Welcome" screen can be closed, but if you have never used Eclipse before, it may contain some useful information.

Step 5: Start a new project. Click on File -> New -> C++ Project. Type in a Project name (like "fabathome"). The default location is acceptable, it will put the new project into the workspace folder selected in step 4. Under Project types select Makefile project and under Toolchain select Other Toolchain. Click on Finish.

C++ project
C++ project
The new empty c++ project
The new empty c++ project

Step 6: Add the source files. Click on File -> Import.... Under import source select General -> File System. Click next.

Import files
Import files

In From directory enter the directory containing the source files. Select all the source files, including "makefile" (there are 17 in firmware version 4). For the Into folder select the project that was created in step 5. Click Finish.

Select files
Select files

The workspace should look like the screenshot below:

Firmware project
Firmware project

Step 7: Build the firmware. Click on Project -> Build All. This will invoke make and build the firmware. Errors or warnings can be seen in the Problems tab and the raw output of the compiler commands can be seen in the Console tab.


Rowley CrossWorks Firmware Development Environment

Version 2 and 3 of the firmware was written in C using Rowley CrossWorks for ARM which is available for a 30 day free trial - more than enough time to program your micro, and possibly to play with the firmware as well. NOTE: If you want to use Rowley CrossWorks for free, you need to request an evaluation license - this generally takes about 24 hours when you make your request via email. CrossWorks simplifies the installation of the Fab@Home firmware onto the microcontroller, hence it is recommended that you download the trial and use it for programming.

Download Rowley CrossWorks for ARM

Download Chip Support Package for the LPC2000 Family

Install CrossWorks and Request Evaluation License

As an alternative, there is a variety of GNU C compiler-based toolsets which can work with the ARM7 core. For more info on these see:


Programming your LPC-H2148 Microcontroller with OpenOCD

Programming the microcontroller with OpenOCD involves connecting it to your PC via a JTAG adapter and a USB cable (simultaneously) and running OpenOCD with a script to connect and write the firmware object code (.elf) file. After that, you will only need to install the Windows USB drivers, and you should be ready to run the application. The following instructions assume that the ARM-USB-OCD JTAG adapter is used.


Step 1: Download OpenOCD. Once OpenOCD is downloaded, run the installer. When the installer asks to choose the components, disselect "Make utils", it is unnecessary for programming the microcontroller. The other options should be checked, and the rest of the default settings are acceptable.

Step 2: Download OpenOCD Configuration Scripts and the firmware object code (.elf) file. Extract the scripts and the firmware (.elf file) to the same directory, like in the screenshot below:

OpenOCD scripts
OpenOCD scripts

Step 3: Connect the 20pin female 2-row socket of your JTAG adapter to the black 20pin male header on the top face of the LPC-H2148 microcontroller board. Note that the connector and socket are "keyed" with a tab and slot so that they can attach in only one orientation.

Step 4: Connect the USB cables to both the JTAG adapter and the LPC-H2148 microcontroller board.

Step 5: Run openocd_go_flash.bat (by double clicking, or through a console) to download the firmware to the microcontroller. This will take a few seconds. You should again see the memory being erased and the code downloaded. Once the download finishes, the microcontroller will reset and begin to run.

Step 6: If all of this succeeds, then you should see three lit LED's on your microcontroller. The red Power LED and Yellow USB Link LED should be constantly lit, and the Green Status LED should be blinking, 1 second on, 1 second off, indicating that the firmware is running and detects no errors. You should now be asked by Windows to install the USB drivers for the Fab@Home...

Step 7: You can now disconnect the JTAG cable from the microcontroller, and start working with your Fab@Home!


If you are using the parallel port, please follow the instructions below (Contribution from The Renato Archer Center of Information Technology - CTI, Campinas, Brazil)

Image:LogoCenPRA.jpg

Commisioned: July 4, 2008.


Step 1: Download this package. It contains an older version of OpenOCD that works with parallel port. It also contains all the scripts and necessary files to program your LPC-H2148 Microcontroller.

Step 2: Run the installer openocd-r520-20080322.exe. When the installer asks to choose the components, disselect "Make utils", it is unnecessary for programming the microcontroller. The other options should be checked, and the rest of the default settings are acceptable.

Step 3: Download the firmware object code (.elf) file. Extract the firmware (.elf file) to the same directory of the scripts, like in the screenshot below:

Directory organization
Directory organization

Step 4: Connect the 20pin female 2-row socket of your JTAG adapter to the black 20pin male header on the top face of the LPC-H2148 microcontroller board. Note that the connector and socket are "keyed" with a tab and slot so that they can attach in only one orientation (check if the parallel port is using the EPP mode).

Step 5: Connect the USB cables to both the JTAG adapter and the LPC-H2148 microcontroller board.

Step 6: Run the batch inside the folder "driver" install_giveio.bat (by double clicking, or through a console). Then check if everything is ok by running the batch status_giveio.bat, like in the screenshot below:

Driver status
Driver status

Step 7: Run openocd_go_flash.bat (by double clicking, or through a console) to download the firmware to the microcontroller. This will take a few seconds. You should again see the memory being erased and the code downloaded. Once the download finishes, the microcontroller will reset and begin to run.

Step 8: If all of this succeeds, then you should see three lit LED's on your microcontroller. The red Power LED and Yellow USB Link LED should be constantly lit, and the Green Status LED should be blinking, 1 second on, 1 second off, indicating that the firmware is running and detects no errors. You should now be asked by Windows to install the USB drivers for the Fab@Home...

Step 9: You can now disconnect the JTAG cable from the microcontroller, and start working with your Fab@Home!

Programming your LPC-H2148 Microcontroller with CrossWorks

Programming the microcontroller with CrossWorks involves connecting it to your PC via a JTAG adapter and the USB cable (simultaneously), running CrossWorks, opening up the Workaround Dummy Project and the firmware object code (.elf) file, telling CrossWorks to connect to the microcontroller via the JTAG cable, and building and running the dummy Workaround project, then finally downloading the firmware object code onto the micro. After that, you will only need to install the Windows USB drivers, and you should be ready to run the application.

You can test operation of the firmware by running the Fab@Home application, initializing the hardware, and checking the "Firmware version" number at the top of the "View->Printer Status" window.

JTAG Adapters

In order to program your LPC-H2148 you will need a JTAG adapter which works with your firmware development environment.

JTAG for Rowley Crossworks

At present, the following two JTAG adapters are known to be compatible with Rowley CrossWorks:

JTAG for ARM GCC Toolchain

Olimex the manufacturer of the LPC-H2148 board, has a simplified set of programming tools for the ARM processors, called their "Olimex's ARM GCC for Windows Dummies", based on the GNU C ARM toolset. Olimex makes a very nice "all in one" JTAG adapter, called ARM-USB-OCD for use with these free programming tools, but currently it is unknown whether this will work with Rowley CrossWorks as well - if you know, please update this!

Programming via Flash Utility

The NXP (formerly Philips) LPC2148 can also be programmed via serial port 0 in a special mode. Please download the archive below for the Flash utility and how to use it. The LPCH2148 board used in the Fab@Home Model 1 is not explicitly described in the application notes, but correct configuration can be inferred from the schematics of the other boards described. Remember that the flash bootloader communicates via UART0 of the LPC2148. By default on the interface headers of the LPCH2148 board are configured with UART0 TXD0 at EXT1-1 and UART0 RXD0 at EXT1-2. We will try to document this more fully in the future.

Software

Hardware

SparkFun electronics sells a simple RS232-TTL level shifter board that might simplify interface to the UART0 - it looks as though some 22AWG hook up wire could be used to connect the pins on their level shifter board to the EXT1-1 and EXT1-2 header socket pins on the LPCH-2148. The SparkFun page includes a schematic for their board. There are many schematics for RS232-TTL oonverters on the web as well.

Navigation

  1. Buy tools required for assembly
  2. Choose your style options
  3. Buy the parts for the Model 1
  4. Build the cables and subassemblies
    1. Cables
    2. Machine Base
    3. XY-Carriage
    4. Z-Carriage
    5. 1-Syringe Tool
  5. Assemble the subassemblies into the complete Model 1 System
    1. Assembling the Chassis
    2. Mounting the 1-Syringe Tool
    3. Preparing and mounting electronics
  6. Program the LPC-H2148 with the Model 1 Firmware
  7. Install the Fab@Home Model 1 Application
  8. Commission the Model 1
  9. Use the Model 1
Personal tools