Find Ethernet readers via UDP introspection
Using UDP introspection, you can locate all ID-engine XE readers in the network. The advantage of this method over SLP: You not only receive the readers' IP addresses, but also a mapping of each reader to its connected PC. Thus, we recommend it if the following requirements are met.
Requirements
- You implement your host application as a server.
- Readers are not protected by a firewall.
- Each reader is connected to a PC (or another device with its own IP address).
- The host knows the PC's IP address.
Process overview
- The host sends a specially formatted UDP packet to the PC.
The packet contains the IP address of the host and the PC. - The reader reads the packet.
This is possible due to the promiscuous mode of the embedded Ethernet switch: In this mode, the reader can process any Ethernet frame that is received by one of the switch ports – This includes frames that aren't addressed to the reader itself, but to the connected PC. - The reader responds with its own IP address as well as the PC's IP address found in the UDP packet.
Process in detail
Connect reader to PC
Connect the reader to the PC via the reader's Device port.
Don't insert another switch stage
Make sure the reader is directly connected to the PC to avoid an increase in network load seen by the reader.
Activation
UDP introspection is automatically enabled as long as the reader is not configured for a host yet. If the reader is configured, but the host is not available, the reader will re-enable UDP introspection after several connection failures. Thus, you can easily reassign the reader to the host in case of network topology changes, e.g. a new host IP address.
Send UDP packet with BRP frame
Send out a UDP packet with the following BRP frame periodically to the PCs connected to the readers:
Name | Type/Size | Description |
---|---|---|
FormatVersion | Integer (8 bits) | Has to be 0x01 |
HostIpAddress | Raw data (4 bytes) | IP address of host application |
HostPort | Integer (16 bit; MSB) | Port via reader can contact the host application |
Stick to maximum frame rate
The reader analyzes every arrived Ethernet frame within an interrupt routine. This takes about 25μs per frame independent of the frame size. If the receiving frame rate is higher, frames will get lost. Short term spikes are no problem as the reader switch buffers the received frames (buffer size is approx. 8k).
If the frame rate is close to the limit, the reader will get caught in a loop working up the interrupt routine again and again. This will block the reader as there's no processor time for any other tasks left.
Reader response
When the reader detects the above frame, it will try to open a BRP-over-TCP connection to the host and send an identification frame with the ConnectReason set to UDPIntrospection:
Name | Type/Size | Description |
---|---|---|
FormatVersion | Integer (8 bits) | 0x01 |
ConnectReason | Bitmask (16 bytes) | 0x0010 (the value for UDPIntrospection) See all connect reasons here |
SerialNumber | Raw data (8 ASCII encoded decimal digits; no trailing zero byte) | Serial number of reader |
Configure the reader
-
Deploy the reader configuration. It needs to contain the host interface component Ethernet - Host as server.
To implement the reader configuration via Ethernet, please get in touch
-
Reboot the reader using the Sys.Reset command.
From now on, the reader will open a connection to the host when certain events occur.
Try it out with our app note
The app note appnotes\udp_introspection
in the SDK gives you a working example of the implementation.
It requires a BRP server to run somewhere in the network. For testing, you can use appnotes\tcp_server
(or its precompiled version \binaries\winXX\release\appnote_tcp_server.exe
).