The DeviceMate hardware and software provide a way to network-enable an embedded device. Connecting any device with RS232 to a DeviceMate unit using a serial connection (CMOS-level signals can be used if the DeviceMate unit is a Rabbit core module), gives the device a gateway to local networks and the Internet.
With DeviceMate hardware and software, your embedded device can effectively send e-mail and serve web pages. It can also upload files to a file system that was previously set up on the DeviceMate and then update variables referenced in the files. This makes it possible to remotely monitor I/O on the device with a web browser.
The DeviceMate can also act as an external watchdog for the embedded device (aka "target"). Rabbit-based embedded targets can be reprogrammed remotely via the DeviceMate.
DeviceMate software includes library support for programming both the target embedded controller and the DeviceMate controller. Since there are two controllers in a DeviceMate system, there are two sets of software components: one on the DeviceMate unit and one on the target. Application programs run on both the DeviceMate unit and the target.
Sample programs for the DeviceMate unit are in
samples\dmunit\. Sample programs for a Rabbit-based target are insamples\dmtarget\; for nonRabbit targets they are insamples\dmtarget\Arch\. See "Sample Programs" on page 5 for more information.There are several sample programs provided for the DeviceMate unit. As with all sample programs, they are in source code form. They all can be used with any of the many sample programs provided for the target. For most features, you simply set some macros and, if necessary, set up the network addresses, then you compile and load the application with Dynamic C to the DeviceMate. Some features require additional programming on the DeviceMate unit.
You program your embedded target to talk to the DeviceMate via a serial port using the DeviceMate subsystem APIs provided.
2.1 Hardware Connections
For details on hardware connections, please refer to the DeviceMate Getting Started Manual. The following figure is a quick look at the hardware connections.
2.2 Software Components
The DeviceMate feature set comprises:
- File System
- Message Logging
- Remote Monitoring of Target I/O
- Remote Program Download (Rabbit-based targets only)
- Serve Web Pages
- TCP and UDP Sockets
- Update Variables on Web Pages
- Watchdogs
Several software subsystems implement the DeviceMate feature set. All of the subsystems used by the target are described in Chapter 3 starting on page 9. All of the subsystems used by the DeviceMate unit are described in Chapter 4 starting on page 29.
2.2.1 Layers of Communication
Many of the subsystems are clients of eXtended Target Communications (XTC). XTC provides a reliable transport layer. But, as the flowchart below indicates, subsystems can call Target Communications (TC) routines directly, as can applications. If XTC is not used, then packet delivery to the peer is not guaranteed.
2.2.2 Sample Programs
The sample programs run in pairs (except for
loader.c).
To run the sample programs, follow this sequence of steps:
- Connect the programming cable to your PC and the DeviceMate.
- Connect power to the DeviceMate unit.
- While running Dynamic C v 7.10 or later, configure and compile one of the sample programs for the DeviceMate. See "Applications Running on the DeviceMate Unit" on page 29 for configuration information for these programs.
2.2.2.1 For Rabbit-based Targets:
- Disconnect power to the DeviceMate.
- Disconnect the programming cable.
- Connect the programming cable to the target.
- Connect power to the DeviceMate and target.
- While running Dynamic C (version 7.10 or later), compile the application to the target and run it. For example, to check out the functionality of the watchdog subsystem, open the file
samples\dmtarget\wd.c. Hit F9 to compile and run the watchdog application.2.2.2.2 For nonRabbit-based Targets:
The initial setup for all sample programs is the following:
- Create a base directory on the target device (or development machine). The following steps assumes this directory is called
dm.- Copy the target-specific
.zipor.tarfile todm.
- For example:
CD dm
COPY e:\dc710\samples\dmtarget\arch\i386\tc_bc.zip
- or, for Unix-based systems:
cd dm
cp /cdrom/dc710/samples/dmtarget/arch/sparc_sol8/tc_solaris.tar
- For example:
PKUNZIP tc_bc.zip
- or, for Unix-based systems:
tar xvf tc_solaris.tar
- Examine the README files for detailed instructions.
- Configure the library. This means editing
dm/tc_conf.hto accurately reflect the target machine architecture. It is recommended that the debugging flags be defined, at least initially.- If the target is not one that is supported "out of the box," you will possibly need to write some adapter code. See "Porting Guidelines for NonRabbit-Based Targets" on page 101 for directions on how to do this.
- Compile the library and samples using the "make" command.
- Connect the serial port of the target processor to that of the DeviceMate.
- Ensure that DeviceMate and target configurations match, especially serial port speed.
- Run the appropriate DeviceMate sample program (e.g.,
devmate.c), with or without Dynamic C debugging (stdio window etc.). We recommended running with the Dynamic C programming cable connected and the debugging flags turned on intc_conf.lib.- Execute the appropriate sample program on the target.
2.3 Further Programming
The sample programs can be used as templates for further code development. Depending on the application running on the embedded system, this could be very little or quite a bit of design and coding work.
Users can also develop customized subsystems. Information needed for doing that can be found under Guidelines for Writing Custom Subsystems.
2.3.1 Faster Debug/Development
With a Rabbit-based target, using two programming cables and Dynamic C project files allows for a faster debug/development cycle. The default project file,
default.dcp, uses COM1 for serial communication. Use the File | Project | Save As . . . menu option to create a project file with a descriptive name, such asdmUnit.dcp. Then go to Options | Communications and choose COM2. Again, use the File | Project | Save As . . . menu option to create a new project file with a descriptive name, this time something likedmTarget.dcp. Now you can run two copies of Dynamic C side by side, each using a different project file with the correct comm port for the controller it is talking to.
| Z-World http://www.zworld.com Voice: (530) 757-3737 FAX: (530) 757-3792 sales@zworld.com |