| Index >> Technical support & download >> Application notes
AN20: UDP Config in your applications
Most of the HW group devices allow you to set the IP address using UDP broadcast. It is implemented in the Hercules utility, for example. The AN20 is intended for companies that want to implement the device search in their applications.
In the "UDP Config" tab of the Hercules utility its possible to search a local network segment for our device using UDP broadcast. The you can for example change the device's IP address, MASK and GateWay. This application note describes the format used to search for devices only, it does not describe the codes for entering the configuration in the module.
How does device lookup/setup work?
Module identification and codes
The device will answer the UDP broadcast with a frame, where it send its setting and a special code. Then the device (module or a HW unit) awaits another frame with configuration from the PC (the Hercules utility). The received frame is verified, and if the encoding is correct it's accepted, otherwise it's ignored. This way also the recipient is identified, if the frame from the PC is sent as UDP broadcast. But this is not necessary, it can also be sent as Unicast, and then it will be answered only by the target device.
Device answers (module or HW unit)
| 00 |
unsigned char |
MAC[6]; |
// MAC address of the module |
| 06 |
unsigned char |
IP[4]; |
// IP address |
| 0A |
unsigned char |
Mask[4]; |
// Subnet mask |
| 0E |
unsigned char |
FwIP[4]; |
// Acceptable address range IP |
| 12 |
unsigned char |
FwMask[4]; |
// Acceptable address range MASK |
| 16 |
unsigned char |
Unit[2]; |
// Device type - more |
| 1A |
unsigned char |
GW[4]; |
// GW address (sometime called User1) |
| 1E |
unsigned char |
User2[2]; |
// DEVICE CTRL bits settings - more |
| 20 |
unsigned char |
Port[2]; |
// incomming TCP port number |
| 22 |
unsigned char |
crypt[16]; |
// Cryption for Write |
| Device type |
|
|
| Unit2[1] |
A0 A1
A2 A3
A4 B0
B1 B2 |
| Unit2[0] |
C0 C1
C2 C3
D0 D1 D2
D3 |
| A - Device type |
5 bits |
// Device FW type name (e.g. Poseidon) |
| B - General firmware version |
3 bits |
// Device FW main number (1.8.2] |
| C - Firmware version |
4 bits |
// Device FW second number (1.8.2] |
| D - Firmware sub-version |
4 bits |
// Device FW third number (1.8.2] |
| DEVICE CTRL bits settings |
| User2[0] & 1 |
bit 0 |
R/W |
Enable TCP TEA authorization |
| User2[0] & 2 |
bit 1 |
R/W |
Enable NVT |
| User2[0] & 4 |
bit 2 |
R/W |
Enable TCP Setup (default on the port 99) |
| User2[0] & 8 |
bit 3 |
Read only |
DHCP support (0 = DHCP not supported) |
| User2[0] & 16 |
bit 4 |
R/W |
Enable DHCP, fixed IP address ignored |
From the previous description you can now see, how to use the module search in your applications. If you also need to modify the configuration of the module, please contact us we will send you detailed information.
The described algorythm, including a MAC address filtering, can be found in the IP Relay Controller software
source codes - these codes are compiled using "Borland C++ Builder 6.0".
DOWNLOAD & Links
|