The
following is intended as some practical help when developing with
the TC45. More detailed information is available in the Siemens
Java User's Guide.
SDK
Installation
Install Sun ONE and the J2ME compilers BEFORE you install the Siemens
SDK - it will detect the prescence of the compilers and add all
the extra libraries for you. These compilers and the Sun One IDE
can be downloaded from http://java.sun.com/j2me/.
Development
Environment
Consider carefully the development approach used. Although devices
such as the MTC45TC provide a good development platform, it may
be better to use more complete devices such as the Siemens DSB.
The DSB allows the developer to isolate any or all of the pins of
the TC45. This means that the hardware can be gradually integrated
with the new target system. For example, power supplies can be a
critical part of a board design, and it may be better for the software
writers to make a start on the software while the hardware is being
developed. The DSB will allow you to connect logic lines to the
target application while wtill using a tried and tested power supply
design.
Embedded
Systems
For JAVA programmers coming from the PC environment to the embedded
environment, please remember that the TC45 has some differences
when compared to a PC! Although there is a filing system on board
which appears like a hard disk, it should not be used in the same
way as a hard disk may be used for 'scratch' information. The 'disk'
on the TC45 is in Flash memory, which has a finite number of read/write
cycles, in the order of 100,000. Therefore, files should be written
to the memory relatively infrequently, maybe on power-up/down or
when a significant amount of data has been collected. Using this
memory instead of the RAM as a scratchpad is not encouraged.
Simulators
Siemens provide a PC simulator so that you can run JAVA code on
a PC (which has some trace & debug advantages). However, you
must remember that compared to an embedded system, the PC will have
some disadvantages, such as not being fully integrated with the
target hardware. The TC45 does communicate with the PC using the
serial interface, so that the I/O can still be operated via the
AT commands. One advantage of using the simulator is that you can
monitor the serial interface using something like PortMon,
but I find that for most of the development process that PC simulators
are a hinderance! They may well protect you from other vagaries
like power supply defects, network and connectivity issues to name
just a few.
Serial
Port Switch or Two Com Ports
This will make life easier when developing. Don't forget that ASC0
is principally used to connect to a PC to drag-and-drop code, and
ASC1 as the application port. If you are monitoring the application
output using a PC, then swapping serial cables becomes a pain, so
a second serial port is the preferred option!
RTFM
The Siemens manuals are very complete and should actually contain
everything you need. The main problem, is they are quite large -
so sometime just finding the information you need can be a challenge,
but I assure you, it is normally there!
OTAP
This is something I often get questions about. Get one parameter
wrong, and it does not work. This configuration works well, with
these AT commands on the modem :
at^scfg="Userware/Passwd","","password","password"
//
Set the OTAP password (you may not want to use the word 'password'!
at^scfg="Userware/Autostart","password","1"
// Set the program to
autostart
at^scfg="Userware/autostart/appname","password","a:/ota/rs232demo.jar"
//Where the program will
be installed
at^scfg="Userware/autostart/delay","password","10"
// delay after power up
to program start
The SMS message
then sent to the TC45 is like this :
OTAP_IMP1.0/x0aPWD:password/x0aAPPDIR:a:/ota/x0a
JADURL:http://www.tdc.co.uk/java/rs232demo.jad/x0a
BEARER/x0aAPNORNUM:internet/x0aNETUSER:web/x0a
NETPWD:web/x0aSTART:install
(all sent as
one line, one SMS)
Both the JAD
and the JAR files are expected to be present on the web at the appropriate
URL - www.tdc.co.uk/java in this example, replace this with the
right directory.
Reference
Books
These JAVA reference books have been used and have proven to be
of great value, you can easily buy them from Amazon.
JAVA 2
in easy steps
J2ME in
a Nutshell
J2ME:
The Complete Reference
Core J2ME
Technology & MIDP (Sun)
Disclaimer:
The above is purely Bob's own opinion, based on many years experience
in developing code for embedded systems. Individual developers may
wish to ignore these suggestions, but Bob thinks you should at your
own peril! |