Fab@Home:Model 1 Firmware
From Fab @ Home
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
- Link: Fab@Home Firmware V4 ELF file, FAHv4ELF.zip
- Version: 4
- Date: 18:31, 07 April 2008 (EDT)
- Platform: Windows 2000/XP/2003
- Format: Zip archive
- Size: 16KB
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.
- Link: Fab@Home Firmware V3 ELF file, FAHv3ELF.zip
- Version: 3
- Date: 00:39, 10 May 2007 (EDT)
- Platform: Windows 2000/XP/2003
- Format: Zip archive
- Size: 16KB
- Link: Fab@Home Firmware V2 ELF file, FAHv2ELF.zip
- Version: 2
- Date: 00:39, 10 May 2007 (EDT)
- Platform: Windows 2000/XP/2003
- Format: Zip archive
- Size: 14KB
WinARM Firmware Development Environment
WinARM is available on Martin Thomas' website:
WinARM version 20060606 was used to write the version 4 firmware.
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
OBSOLETE Step 3: Download the LPC2148 boot script, lpc2148-rom-iap.zip. Extract the boot script, lpc2148-rom-iap.ld, and put it into C:\WinARM\armlib\arch\lpc2000\boot\.
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:
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
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.
Step 6: Add the source files. Click on File -> Import.... Under import source select General -> File System. Click next.
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.
The workspace should look like the screenshot below:
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
Step 3: On the License Manager dialog box, click one of the two buttons in the upper right hand corner under the text "If you wish to evaluate CrossWorks...". If you use an email application, like Eudora or Outlook, click "By Mail", whcih will open your email program and address an email to Rowley Co. with a license key request. If you use a web-based email client, click "Manually", and see Step 4.
Step 4: If you chose "Manually", a dialog will appear notifying you that a license key has been copied to the Windows Clipboard. You can then compose an email to email@example.com with the subject "Evaluation License Request", paste in the license key, and send it. You should receive a 30 day evaluation license within 24 hours (on weekdays).
Step 6: In the "Tools" menu, select "Install Package...", and navigate to and open the Philips_LPC2000.hzq chip support package you downloaded above. This provides Crossworks with some chip-specific details which are necessary to communicate via JTAG with the LPC-H2148.
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 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)
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:
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:
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.
Step 1: Download and unzip the firmware object file, and the Workaround Dummy Project, which is a Rowley CrossWorks project file (.hzp) for building a very simple (infinite loop) firmware - this dummy project is necessary to get CrossWorks set up correctly for downloading the actual Fab@Home firmware.
Step 4: Using the second dropdown control from the top left of the CrossWorks window, select the current project configuration to be ARM Flash Release. This is telling CrossWorks that you would like to compile the "release version" of the project without extra code which makes debugging easier, but decreases performance, and that you want it to be stored on the flash memory of the LPC-2148 so that it does not disappear when the microcontroller is not powered.
Step 8: Now connect your PC to the LPC-H2148 USB port with a USB cable. This will provide power to the microcontroller. You should see the red power LED on the micro illuminate, and within a few seconds, you may observe that the mouse pointer on your PC screen is moving on its own in a square pattern. This is a result of the "demonstration" firmware that comes preloaded on the microcontroller from Olimex, the board's manufacturer.
Step 10: If connection was successful, you should see a yellow target connection indicator near the bottom of the Crossworks window. Yellow indicates a successful but inactive connection. If you have any errors at this stage, double check your cable connections and possibly disconnect and reconnect, ensure that the red power LED is lit on your micro, and ensure that you have a valid license for CrossWorks. As parallel ports are not reliably "plug and play", you may need to reboot your PC after attaching the parallel port cable before things will work.
Step 15: Now, in the "Targets" tab in the lower right of the workspace, right click on your JTAG type, and select "Download File->Download ELF File". Navigate to the Fab@Home Firmware object file that you downloaded in Step 1. You should again see the memory being erased, code downloaded and verified.
Step 16: 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...
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.
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:
- Parallel Port to ARM JTAG adapter from SparkFun, $19.95, if you have a parallel port
- USB to ARM JTAG adapter from Rowley, ~$200, if you only have a USB port
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!
- JTAG USB OCD Programmer/Debugger for ARM processors from SparkFun, $69.95, works with RS232 serial and USB
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.
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.
- Buy tools required for assembly
- Choose your style options
- Buy the parts for the Model 1
- Build the cables and subassemblies
- Assemble the subassemblies into the complete Model 1 System
- Program the LPC-H2148 with the Model 1 Firmware
- Install the Fab@Home Model 1 Application
- Commission the Model 1
- Use the Model 1