91.305 home WED MAY 5 WED APR 14 FRI APR 2 FRI MAR 26 FRI MAR 12 WED MAR 10 MON MAR 1 NOTE: THERE IS NO ASSIGNMENT 5. FRI FEB 20 THU FEB 19 WED FEB 11 MON FEB 9 FRI FEB 6 WED FEB 4 MON FEB 2 WED JAN 28 |
Installing & Configuring Java for HC11BootThis document explains how to:
These instructions are based on the use of JDK version 1.1.8, which is old, but (a) works just fine, and (b) is way smaller and simpler than the latest stuff. You are also free to use the machines in the Engaging Computing Lab (OS306). These machines already have JDK 1.1.8 installed per these instructions. At the end of this document, there are notes for using the HC11Boot.java program on non-Windows computers. Your Own PCThe following instructions are for those of you who wish to set up your own PC for development. Installing JDK 1.1.8You will need to download and install Sun's Java Development Kit. I recommend the old 1.1.8 version because it's smaller and faster than the latest versions and it runs perfectly well. So the instructions that follow will assume you're taking my suggestion and using this obsolete, but eminently functional, version of Java. You are of course free to download and install the latest-and-greatest, but then you'll have to adapt the instructions accordingly on your own. First download the 1.1.8 JDK from Sun. You may use their URL http://java.sun.com/products/archive/jdk/1.1.8_010/index.html or you may retrieve a local copy. Run the installer, and the whole system will get installed under C:\JDK1.1.8\. Installing javax.commjavax.comm is the name of the standard libraries created by Sun for interacting with a serial port from the Java language. I have created a tiny zip download that has precisely the three necessary files and an installer batch file for putting them in the right place. Download the javax.comm for JDK118 zip file and extract it into a temporary directory. There will be three files and an installer batch file named install-JDK118.bat. Run the batch file (double-click on it), and the following files will be copied to the following directories:
After the installer runs, check that the three files are indeed in their specified locations. Configuring PathsNow you need to tell your PC where the Java binaries are located (they're in C:\JDK1.1.8\BIN\). Also, you need to create an environment variable named CLASSPATH that tells the Java software about the new comm.jar communications library. The way to do this is to modify the Environment Variables setting. Go to the Control Panels, then open the System icon. From the System Properties window that then opens, click on the Advanced tab. Then, click on the Environment Variables button. The Environment Variables window will show. In the bottom half are the System Variables. There will already be an entry for the PATH. You want to add on to the end of the existing value, so select PATH, click the Edit button, right-arrow to the end, and then add: ;C:\JDK1.1.8\BIN\ Note the initial semicolon. Then you'll want to create a CLASSPATH environment variable. Click the New button, type CLASSPATH into the name field, and set its value to be: .;C:\JDK1.1.8\LIB\COMM.JAR Note the initial period, then a semicolon, followed by the location of the communications .jar file. Now boot up a DOS shell (Start Menu:Run and type cmd or, if, on an older Windows machine, type command). At the shell, type java . If you see a bunch of text starting with usage: java [-options] class etc. then you're all set. Compiling the HC11Boot.java and Serial.java FilesOK, you're ready to compile Java code! Create a directory for your work, download the two test files for this exercise (use Assignment 3: Files link on left menu), and put them both into the directory:
Please note that Java is case-sensitive with respect to filenames, so the files must have the proper capitalization when installed on your disk: Serial.java and HC11Boot.java. Now, from the MS-DOS command shell, change directory (the cd command) to the directory where these two files are located, and compile them together by typing: javac *.java If you didn't get any errors, it worked! You should now have two additional files named Serial.class and HC11Boot.class. If you got an error related to javax.comm, it probably has to do with the CLASSPATH setting. Go back and make sure you did that step properly. Type set at the command shell and it should show you the CLASSPATH value. Running HC11Boot to Discover Serial PortsNow let's run the HC11Boot.java program. Still at the command shell, type: java HC11Boot Again, please note that you must follow the capitalization HC11Boot exactly. When run without arguments, the HC11Boot program displays a list of available serial ports. You should see a result like: Usage: HC11Boot serial-port Available ports are: COM1 COM2 If you get at least one serial port showing up as available, congratulations! You're now ready to talk to your 68HC11; skip to the next step. If you instead got the message no ports found, there are a couple of possibilities:
To see if you should have available serial ports, please run the standard communications package HyperTerminal (it may already be on your machine; check Start Menu->Accessories->Communications). See if it presents you with any serial ports to connect to. If yes, then it's likely a javax.comm setup problemskip to the next paragraph. If HyperTerminal did not give you any COM port choices, then you likely have a lower-level serial driver problem. This would be beyond the scope of this document, but resolution generally involves a trip to the Device Manager in Windows' System Control Panel, and in extreme cases, change to your CMOS machine configuration. If you suspect a javax.comm configuration problem, make sure that the win32comm.dll file is properly in the JDK bin directory and that the javax.comm.properties file is in the JDK lib directory. Running HC11Boot to Load a Program on your 68HC11The function of the HC11Boot program is to install a program into the 68HC11E's 512 bytes of internal memory using the chip's bootstrap download feature.
The distribution version of the file installs a three-instruction program that turns on bit 4 of the Port A register. This is represented with the following excerpt from the HC11Boot.java file: buf[i++] = (byte)0x86; // RAM loc 0 -- LDAA with 0x10 buf[i++] = (byte)0x10; // 1 0x10 (bit 4 on) buf[i++] = (byte)0xb7; // 2 -- STAA extended to 0x1000 buf[i++] = (byte)0x10; // 3 0x10 buf[i++] = (byte)0x00; // 4 0x00 (the PORTA reg) buf[i++] = (byte)0x7e; // 5 -- JMP extended to 0x0005 buf[i++] = (byte)0x00; // 6 0x00 buf[i++] = (byte)0x05; // 7 0x05 (loop the JMP!) The three instructions are LDAA 0x10, STAA 0x1000, and JMP 0x0005. These instructions put the number 0x10 into the A register, store this value to the PORTA data registerthereby setting the Port A 4 bit highand then loop endlessly. Now we are ready to download this program to the 68HC11. OK, you've got a valid serial port, probably COM1 or COM2 since you're on a PC. Plug your assembled 68HC11 system into the serial port using your DB9 cable.Turn the board on. LED8, which should be hooked up to the 6811's TxD, should be off. This indicates that the 6811 is correctly in the bootstrap mode (power on but TxD LED off). Also, the probe LED indicating the state of PA4 should be green, indicating logic low. This is the default power-on state of the PA4 output. Type at the MS-DOS prompt: java HC11Boot COM1 replacing COM1 with whichever serial port you are using, of course. The green SER-IN LED on the UML305DEV board should start flashing. The LED8 HC11 TxD indicator should also flash, as the 6811 replies to the host computer while the bootstrap download is happening. (The TxD isn't hooked back to the PC, so the replies aren't received, but that's OK.) When the flashing is done and the HC11Boot program has finished, the probe LED should turn red, indicating logic high. Then little boot program has run and set PA4 to a one! Also, the LED1 TxD indicator should turn on fully. If all this works, congratulations! Your 68HC11 system is up and running. If you didn't get the PA4 to turn to one, then check all of your wiring and try again. You may need to come to lab where we have more advanced tools for debugging the set-up. Notes for Non-Windows OSesThe only special trick for running on non-Windows OS'es is finding a replacement for the javax.comm libraries. There is an open-source initiative located at http://www.rxtx.org for making replacement javax.comm-compatible drivers for lots of different OS'es. From this site, download, configure, and install the rxtx drivers appropriate for the OS you are running. There are version of the rxtx software with the comms routines located either in the javax.comm package or a gnu.io package. Use the version that has the stuff in javax.comm. Last modified: Friday, 20-Feb-2004 09:29:21 EST by fred_martin@uml.edu |