Charon I - SNMP I/O Thermometer - First steps

There is a chance to program a lot of SNMP applications in C language and our development kit „Web51 ANSI C – SNMP“ contains many examples, which helps you to get in quickly.

The most advanced application is „SNMP I/O Thermometer“, which you can use together with JAVA application „Thermometer“, instead of a common SNMP client, it controls a serial RS-232 link, up to 32 binary inputs/outputs and 4 1-Wire thermometers..

This text will tell you, how to install and test SNMP application. Because of the huge properties of this application, you can use it as a final solution without any programming.

SNMP I/O Thermometer

The firmware is made for the Charon I modules and it works with the following kits:

Charon I DK (Development Kit) is a simple and cheap development kit, which you can use for testing and also for a final application. It contains only a basic peripherals, it doesn’t have the shift registers.
 
Charon I&II DB   (Development Board) is a development kit, which contains direct inputs and outputs, shift registers for external inputs/outputs, LCD display connection and direct 1-Wire output.
Charon I&II DB also contain peripherals, which are supported only by Caron II module. (second serial RS-232 link, JTAG, SERIAL FLASH up to 4 MB, ISP programming interface..).

These two development boards might be use for testing, but finally they should be used as a final solution, especially the second one because of it’s peripherals possibilities. Anyway, the module should be used in any basic board, which contains the galvanical Ethernet separation and power supply.

The controlled peripherals

The binary inputs/outputs width depends on the number of shift registers, which are connected one bz one. The extedned peripherals are working only if there was set a „special“ mode of the periphery from the JAVA application or any SNMP Client. In the „paralel“ mode, you can access one P1 8 bits I/O port directly.
  • Serial RS-232 line (data from RS-232 are sent to the SNMP client as the traps)
  • 0 .. 32 binary inputs
  • 0 .. 32 binary outputs
  • up to 4 1-Wire thermometers

The RS-232 parameters are set by SNMP, in our case from JAVA application. All the incomming data are sent es a SNMP trap.

The 1-Wire thermometers are detected automatically after power on.

The thermometers are detected after power on or during the program running so you can reconnect any 1-Wire thermometer and it will be found by the system. You have to specify, which thermometer are you going to use by the thermometer’s index in JAVA application. The thermometers are sorted by it’s ID.

The SNMP module’s firmware instalation

Upload SNMP firmware

The Charon Module has already the default firmware Convertor Ethernet / RS-232 uploaded, so the first step is to change the firmware containing SNMP application. We will use the original Atmel's Flip program for upload the T89C51RD2 processor..

You should download the FLIP from official web pages of Atmel's company or you should download an older, stable version Atmel FLIP 1.6.

PSEN – programming

Connect the module Charon to the RS-232 serial link (using the serial cable, which is included in the development kit) and connect the PSEN jumper.

You can find the PSEN jumper's position on the development board (Charon I&II DB on the left side- the bottom position „Forced“, Charon I DK under the LINK and POWER LEDs).

Since you have connected the PSEN jumper, switch the power supply on. Select the processor type (Device => Select => T89C51RD2) in the Flip program and open the firmware file with the HEX extension.

Set the RS-232 programming port (Settings => Communication => RS-232). If there was an error displayed, check the PSEN jumper position, or check the serial cable type (3 wire, RX, TX, GND) (if you are using Charon I&II DB, check the RESET jumper position - must be in x51 pos. and reset the module).

  • Do not forget to check the ERASE and BLANK CHECK checkboxes.
  • Disconnect the Atmel Flip program after programming has done.
  • Finally disconnect the PSEN jumper.
  • Connect the SETUP (T0) jumper.

Start any type of serial terminal (TeraTerm, Terminal), or we should recommend you to use our „Ethernet Converter SETUP“,which you can download from DOWNLOAD page on www.HWgroup.cz.

RS-232 SETUP for the SNMP I/O Thermometer Application

Set the serial port parameters to 9600 Bd 8N1, no handshake, in the Terminal application. Be sure you have connected the SETUP jumper and PSEN jumper is disconnected. Reset the module than.

ATTENTION
After each firmware upload, you must make RESET all the module's SETUP parameters to default. The internal EEPROM must be initialized by this way. Otherwise, the module does not work properly.

Make this command:

d ... load default setup
After the setup is reinitialized, set the IP address, Gateway, Mask and „target trap adress“.
t ... enter target trap address
Target trap adress is and address, where all the UDP packets with SNMP traps will be sent. This address is the only one, which should communicate with the module. Probably you will set your own IP address here.

If you are ysing DHCP server, or you can't remember the IP address, run the „IPconfig“ in command line – The Windows System will write DNS, IP, MASK and GATEWAY. The other properties are 0.0.0.0 = OFF (do not send any UDP packets), 255.255.255.255 = UDP broadcast.

v ... set port value
This command defines the I/O port's value after power on. You can define for example switching off some devices after the system restart. The value is a decimal value in range 0..255
p ... switch port type
This command changes the ports properties. The direct means the direct port access (you can have only one 8bits I/O port). The shifted property is used with the shift registers and 1-Wire thermometers. If you are using Charon I&II DB do not forget to set the version.
s ... Web51 system info
This command displays the actual network parameters (MAC, IP, GW, MASK)

If you have finished your settings, disconnect the SETUP jumper and reset the module. There will be displayed:

EEPROM loading, preserving MAC, getting
in the serial terminal window.

Conclusion

The module's firmware is now set up. It's time to connect the module to the Ethernet and try to communicate via SNMP. If you would like to be sure the module is communicating well, try to Ping the module's IP address from your PC. The Ping is a part of ICMP and works also under UDP and SNMP, if the device does not support TCP/IP.

Installing and running the JAVA „Thermometer“ Application

We have set all the Modules parameters now. The next step is to install and application, which can communicate with the module via SNMP. You should use any SNMP client or browser, or if you are beginner or you don't want to develop your own application, you should try our JAVA app. „Thermometer“. This JAVA app. will show you all in graphics and you can use it to set up the module

The basics about JAVA language

Java is getting to be the most popular object programming language. We would like to explain some basic terms.
  • JAVA SDK (Software Development Kit)
    The SDK contains a compiler the .java source codes to the .class files and all you need to develop your own JAVA applications. If you would like to use only just programmed applications, it's not necessary to install the whole package.
  • JRE – JAVA runtime enviroment
    The basic environment, which can run a JAVA code, so you need JRE to run all your JAVA applications. The most popularized JRE by SUN Microsystems (the JAVA developer) is Java Web Start 1.2. It's a kind of package of extensions, which can run the applications from one file, or directly from the web. It's a standard in the basic JRE.
  • .java
    A text file containing the JAVA source code.
  • .class
    A "byte code" = an universal run able code, which does not depends on the Operating System and the CPU. It is created by the .java file compilation.
  • .jar
    Several .class files in one file .jar. This .jar file is a final whole application file. The application is than in only one file, so there is no need to have several files opened, if the application is running.

You can download the last versin of JAVA Thermometer application from: http://www.dfsoft.cz/Charon/

How to work with the „Thermometer“ Application?

You have to install the JAVA SDK or JRE, if you would like to work with a JAVA application. This is not a part of windows, so you can download it from the web: http://java.sun.com/products/javawebstart/download-windows.html

After that you have installed the JAVA support on your computer, you can just only click on the .jar file. You can run the application also from the previous web page.

There is a file named „charon_properties.txt“, which is used for setting up the modules parameters. The file's structure is the following:

max=50

graph_time=1

min=-20

timeout=5000

IP=192.168.6.16

The Application uses a freeware Westhawk, which is an JAVA SNMP implementation for JAVA applications.

The Thermometer Application

Before you run the JAVA application, set the Charon module's IP address in the text file.

Options

If you haven't set the IP address in the text file correctly, the application can't find your Charon module. You can set the IP address also in „Options => Host IP“ menu, together with the SNMP timeout, after witch the SW outputs an SNMP communication error. You can also set the graph parameters in the "Options" menu.

Thermo

There are set the alarm values in the Thermo. If there is the temperature out of limitations (alarms), the module does not wait for the JAVA Client's ask and sends the alarm itself. The Alarm's value is displayed on the thermometer and also in the graph. The alarms are displayed in the text window up to the graph.

Vyzkoušejte alarmy – Set the upper temperature limitation (the red sign) to the for instance 31°C and keep the temperature sensor in your hand. The Temperature goes up and after the alarm value is excited, the Alarm will be displayed:

04:35:07 [0] '31.13 °C' Temperature High from 192.168.6.16“

A note : If your normal temperature is for example 32 – 36 °C you might try to set the lower limitation alarm for example 15°C and a pice of ice

Ethernet

This menu is useful for the remote access and remote modules setting. You can change the module's IP address, Gateway, RS-232 parameters and so on. You can also change the module's receiving port which is 2000 by default and an outgoing IP address (the IP, where the module sends the UDP packets with SNMP traps, so it's the IP of the computer, where JAVA app. or standard SNMP app is running).

The advanced property is „Allowed IP address range“. It is an address range, which is used for the module's communication. The range is defined by the IP address and it's Mask as in the classical networks for the local communication resolution/gateway communication.

Serial

This menu is for setting up the RS-232 serial link on the module. The „serial timeout“ is for setting up the packet making algorithm which packets the continious data flow from the RS-232 link and sends the packets to the Ethernet network. The parameter defines the maximum space length after the last received character. After that this time is excited, the module makes a packet and sends to the network. The timeout is entered in characters. It is because of the baud rate changes. There is no need to change this timeout, if you have changed the baud rate of the RS-232 serial link.

If the Baud rate is 9600 Bd, serial timeout = 7 and there is a continious packet of 15 characters incoming, the module waits after the last character 7ms (7ms= 7 characters in 9600Bd) and than sends the whole packet of 15 characters to the Ethernet as a trap.

Note: All the parameters, which were set remotely are also stored to the internal EEPROM, so they are available and read by the application (using SNMP) also after the applications restart.

 

Port

This menu sets the type of the 8bits I/O port's access.
  • Parallel
    I/O port P1 is used as a direct 8bits port. The port width is 8 pins I/O port P1 1..9, where 9th bit is an INT0 input (the second jumper next to the SETUP one). If you set the port width to 4, the upper 4 bits are used for the network indication as follows:
    - P1.4 – PING
    - P1.5 – ARP
    - P1.6 – SNMP
    - P1.7 – UDP
    You can not use the shift registers and 1-Wire bus in parallel settings.
  • Special
    The I/O port are extended by the shift registers and other peripherals. You can find the detailed description in the Charon I&II DB datasheet.

    - 8bits I/O port are extendable to 32 I/O
    - You can connect up to 4 1-Wire thermometers to the P1.0 port

The described applications has no support for the LCD display connectivity or A/D converters, which are supported by the CharonI&II Development Board.

Using the application with other SNMP clients

If you would like to use any other SNMP Client application, you will need a MIB table for the Charon module. You can get this table in the original ANSI C - SNMP Development System“ directory or you can download it together with the .HEX file and with the sThermometer.jar application.

If you would like to test the firmware, you can use any SNMP Client. You have to load the .MIB file into the same directory as your SNMP client was installed to. Than you have to compile this table to the list of MIB tables in your Client. After the whole installation is done well, the SNMP client will find the Web51 device and display the tree with the module’s variables.

How to use the SNMP protocol?

You can use a development kit ANSI C - SNMP Development Systém for the x51 hardware (not only the Charon modules), which contains solved examples, an easy MIB table generator and so on. Detailed informations are available on http://Web51.HW.cz.


Interesting shortcuts


DOWNLOAD & Links


  • ANSI C - SNMP Development System -The development kit with the SNMP application examples based on x51 project. The ANSI C code is compatible with Keil or SDDC compilers.
  • Readme.txt - All the SNMP applications have detailed readme file in English.
  • Charon I&II Development Board – Scheme, description of the advanced development kit.
  • Charon I/products/charon1/
  • www.HWgroup.cz - The final solution and products documentation.