Get your TINI running

22 Apr

Get your TINI running
For the devices that we will build in the remainder of this book, you need a TINI SIMM, a TINI socket board, a 9-pin RS-232 cable, an Ethernet cable, and a power supply. To complete this chapter you will also need a 1-Wire device, a serial port 1- Wire adapter and a short length of CAT3 or better cable with a RJ11 on one end (to connect to the 1-Wire device).

• The TINI SIMM can be either the 512-kbyte version or the 1-Mbyte version.
• The TINI socket board needs to support the serial, 1-Wire and network connectors.
• The RS-232 cable (serial cable) should have a 9-pin male connector on one end and a 9-pin female connector on the other and have wires 1,2,3,4 (minimum, all 9 is good too) connected in a straight-through fashion (not a null modem cable).

9 Viniculum’s NEXUS socket – http://www.vinculum.com/1004.php
10 TayLec Ltd’s TINITutor board – http://www.taylec.co.uk/

• The Ethernet cable is a standard 10base-T CAT5 cabled with RJ45 connectors on both ends. Whether you use a straight-through cable or a crossover cable depends on whether or not you’re connecting your TINI to your computer’s network card or your LAN hub.

•The TINI board requires 5 volts. The type of power supply you use depends on the socket board you use. If your socket board has an on-board regulator, then you need to pick a supply that is compatible with that (such as a 9-12- volt AC or DC supply, 250-mA (minimum) in the case of the E20). If your choice of socket board does not have a regulator, then you will need to use a 5-volt, DC, 250-mA (minimum), regulated power supply.

Now, let’s connect this all together. Connect your TINI to your personal computer using the serial cable. Connect your TINI Ethernet connector to either your LAN hub with a straight-through CAT5 cable or directly to the network interface card in your personal computer with a crossover cable (you don’t need a network to use TINI). Plug in the power supply and connect that to the TINI power connector. Your TINI should indicate it is on by lighting the “D1” LED (marked on the circuit board) on the TINI SIMM. After a few seconds the “D4” LED will light up, indicating that it has a network connection.

The next step is loading the various pieces of software on your personal computer. Several Java class libraries are necessary to get your TINI development system working. This includes the base TINI Java virtual machine, TINI development libraries, and 1-Wire development libraries for both TINI and your personal computer. These are schematically shown in Figure 5-4:

TINI libraries, utilities, TINI 1-Wire libraries
The main software library and utilities for TINI are supplied by Dallas Semiconductor. To install and verify them, follow these simple steps. Instructions are provided for both Windows and Linux systems.

For Windows
Download the TINI SDK11 (tini1_02.tgz or the current version) to a temporary directory. Using Winzip or other archive program, open this archive and extract all of the files to the folder of your choice. This will create a folder named tini1.02 (or a similar name, depending on the current version) in that folder and a number of files and folders under that. In our case we extracted these files to the root folder of our c: drive so the TINI API files are in c:\tini1.02\ . We will call this the TINI_HOME directory.

Windows 95/98

Edit your autoexec.bat file and add an environment variable that indicates the TINI_HOME directory and also add the location of tini.jar to your CLASSPATH environment variable.
C:\>notepad autoexec.bat
11 TINI SDK – http://www.ibutton.com/TINI/software/index.html

Create a TINI_HOME environment variable.
SET TINI_HOME c:\tini1.02
You set your CLASSPATH with a line similar to this:
SET CLASSPATH=c:\jdk1.3\lib\;c:\jdk1.3\lib\comm.jar;%TINI_HOME%\bin\tini.jar;.

Windows 2000, Windows NT, Windows XP
For Windows 2000 and Windows NT you will have to use the “System” tool in the “Control Panel.” Select the “Environment” tab and create a new system variable called TINI_HOME. Set its value to be c:\tini1.02. Edit the CLASSPATH system variable and change its value to be:

c:\jdk1.3\lib\;c:\jdk1.3\lib\comm.jar;%TINI_HOME%\bin\tini.jar;.

For Windows XP, use the “System” tool in the “Control Panel.” Select the “Ad-vanced” tab and click on the “Environment” button (under “startup and recovery”). Create a TINI_HOME system variable and edit the CLASSPATH variable as for NT. In the next section we will run JavaKit to talk to your TINI (you can skip the next part if you don’t use Linux).

Linux
Download the TINI SDK12 (tini1_02.tgz or the current version) to a temporary directory.
Uncompress the file and then untar it in the /opt directory (or any other directory you choose).

% cd downloads
% mv tini1_02.tgz /opt
% cd /opt
% uncompress tini1_02.tgz
% tar -xf tini1_02.tar

This will create a folder /opt/tini1.02/ (or a similar name depending on the current version) and a number of files and folders under that. You can install any of these files just about anyplace you like but you need to keep track of where you do and adjust the installation instructions in the book accordingly. Next, we need to add tini.jar  to your CLASSPATH environment variable and add an environment variable that indicates the TINI_HOME directory. Using your favorite ASCII editor, edit your shell startup file as we did in Chapter 3.

For C shell:
set TINI_HOME /opt/tini1.02
set CLASSPATH=
/jdk1.3/lib/:/usr/java/jdk1.3/commapi/comm.jar:$TINI_HOME/bin/
tini.jar:.
For ksh, sh and bash shells:
set TINI_HOME /opt/tini1.02
export TINI_HOME
CLASSPATH=/jdk1.3/lib/:/usr/java/jdk1.3/commapi/comm.jar:$TINI_HOME/
bin/tini.jar:.
export CLASSPATH

Save the file. For these changes to be current, you need to start a new shell. The easiest way to do this is to logout and login again so all shells will use the new CLASSPATH definition.

Running JavaKit
JavaKit is an application that uses the serial port on your computer to connect to your TINI board’s serial port. We will use JavaKit for configuring your TINI’s firmware. A full discussion of JavaKit is provided in Chapter 7. This chapter is just enough to get you started. To run JavaKit from Windows, you need to open a DOS window. This DOS command should run Javakit:

C:\>java -cp \jdk1.3\lib\comm.jar;%TINI_HOME%\bin\tini.jar JavaKit

Note that if
\jdk1.3\lib\comm.jar and
%TINI_HOME%\bin\tini.jar
are in your CLASSPATH then
this DOS command should
work as well:
C:\>java JavaKit
The Linux commands are
almost the same:
% java -cp /usr/java/
jdk1.3/lib/:/usr/java/
jdk1.2/commapi/
comm.jar:$TINI_HOME/bin/
tini.jar JavaKit
or
% java JavaKit

What this means: You need the comm.jar (to access your PC’s serial port) and you need the tini.jar (the class library for TINI) to run JavaKit. JavaKit is a class in the tini.jar file. If you are not familiar with jar files and to satisfy any curiosity about what one looks like, you can view the contents of tini.jar (or any other jar file by specifying the appropriate pate and filename) use this DOS command:

C:\>jar -tf \opt\tini\bin\tini.jar
META-INF/
META-INF/MANIFEST.MF
BuildTINIROM$BryanInt.class
BuildTINIROM.class
TINIConvertor.class
JavaKit$1.class
JavaKit$2.class
JavaKit$ChoiceListener.class
JavaKit$CloseHandler.class
JavaKit$InputHandler.class
JavaKit$LoadFile.class
JavaKit$MacroRunner.class
JavaKit$MListener.class
JavaKit$SerialEventListener.class
JavaKit$SpecialKeyListener.class
JavaKit.class
BuildDependency.class
WatchDog.class

If you have installed everything correctly you should see the JavaKit GUI.

If you don’t see this, check the error messages carefully. Possible errors:
•  Exception in thread
“main”
java.lang.NoClassDefFound
Error: Javakit

Probably means you have incorrectly specifed the location of the tini.jar in the classpath.

•  Exception in thread “main” java.lang.NoClassDefFoundError:
javax/comm/UnsupportedCommOperationException

Probably means you have incorrectly specified the location of the comm.jar in your classpath.

Now let’s connect to TINI. Change the “Port Name” selection box to your serial port that you have connected to TINI, in this case COM1 (Linux folks should use the proper name for Linux such as /dev/ttyS0; the selection box will show the names of the available ports). If the port you have connected to TINI is not listed, there is a problem with the serial port. Exit JavaKit and check that serial ports are properly installed and configured. After selecting the proper serial port, leave the “Baud Rate” set to 115200 and press the “Open Port” button. You should now see a screen similar to this:

If you are using a properly wired socket board from Dallas Semiconductor and a serial cable that is fully wired, you can press the “Reset” button on the JavaKit GUI. If you are using another socket board, this reset button may not work for a variety of reasons.

• Your serial cable does not have pin 4 connected.

• Your socket board does not support reset through the serial cable.

• Your socket board needs a jumper connected to enable this feature.

• Your socket board has a hardware reset button.

Either way, reset your board. You should see the start of the TINI loader:

At this point you can either boot your TINI (start the Java virtual machine and TINI shell) or you can load a new version of the TINI virtual machine. We will load a new virtual machine in Chapter 7; for now we are just getting started. At the > prompt in the JavaKit window, type an “e” and press Enter. This will boot your TINI. A whole bunch of stuff will scroll by in this window—you can use the scroll bars to read through this if you are interested. At this point you are ready to login to your TINI. Press any key to get the login prompt and login. Initially, your TINI has a user called “root” and root’s password is set to “tini”. Try this.

You are now logged into the TINI shell called slush. We are not quite done. You have successfully connected to your TINI through the serial port of the PC. We now need to configure the TINI network settings so you can connect to it through your LAN. We will use the ipconfig command to set your network addresses. Type ipconfig – help for all of the available options. You will need to know what IP address you want to assign to your TINI, your gateway address, and your subnet mask. These all need to be consistent with your LAN addresses. A much more thorough and detailed discussion on network connection is to be found in Chapter 13. An example of this command would be this:

ipconfig -a 192.168.1.85 -m 255.255.255.0

In this case this TINI has the IP address 192.168.1.85 and an IP mask of 255.255.255.0. Set an IP address for your TINI using an address that is consistent with your network. At this point you should be able to connect to your TINI through a Telnet session from any computer in your network. From a DOS command window (or the Windows RUN command prompt):

C:\>telnet 192.168.1.85

and you will get a Telnet window connected to your TINI. Login using the same username and password that you did through JavaKit. If you have gotten this far, then you are now ready to try your hand at compiling and running your first TINI Java program.

114

Your first TINI program

Random Posts

Comments are closed.