WiSnap User Manual 4.41 05282015-ML
Page 38
Wake=6
RAW=2345ab
NOTE:
The RAW value is the 64-bit hex RAW value of the RTC, which ticks at 32,768 Hz.
10.10 Time Stamping Packets
This feature can be used to automatically append 8 bytes to a TCP or UDP packet.
set ip flags 0x87 -
enables timestamp and keeps other default settings
TIME STAMP (MSB to LSB)
User’s TCP or UDP
packet Data
63-56
55-48
47-40
39-32
31-24
23-16
15-8
7-0
The 8 bytes represents the 64-bit raw value of the real-time clock register. The data is appended before calculating the TCP
checksum so that the data passes through the TCP stack correctly. This register counts at
32,768 Hz. If the timeserver function is enabled, the RTC should accurately reflect the real time. This register also counts when
the module is in sleep mode.
11 Sending data using UDP
11.1 Overview
UDP is a connectionless protocol: there is no initial handshaking between the hosts to set up the UDP connection and the
receiver does not send an acknowledgement when it receives UDP packets. Therefore, UDP is an unreliable protocol because
there is no guarantee that the data will be delivered correctly. However, because it is connectionless, UDP is suited for
applications that cannot tolerate too much latency but can tolerate some errors in the data, e.g., video transmission.
To use UDP with the module, you must enable the UDP protocol using the
set ip proto 1
command. You must also specify the
remote host’s IP address and the local and remote port number that you will use for UDP communications. The following
example shows the commands you use to enable UDP data transfer.
Associate to a network:
set wlan ssid
<string>
-
set the network name
set wlan phrase
<string>
-
set the passphrase for WPA and WPA2 modes
Set up the protocol and port number:
1)
set ip proto 1
- enable UDP as the protocol
2)
set ip host
<ip address>
-
set the IP address of remote host
3)
set ip remote
<port>
-
set the remote port number on which the host is listening
4)
set ip local
<port>
-
set the port number on which the WiSnap module will listen
5)
save
- saves the settings in config file
6)
reboot -
reboots the module so that the above settings take effect
NOTE:
If you attempt to send data by physically typing characters on the keyboard or if your microcontroller is not
sending data fast enough, the WiSnap module will send out packets with less data bytes. To avoid this, set the flush
timer to a higher value. By default, it is set to 10 milliseconds. You can choose to either disable forwarding based on
flush timer (use “set comm. time 0”) or set it to a higher value (e.g. set comm. time 2000).
Since UDP is a connectionless protocol, data will start flowing as soon as the module is rebooted. Unlike TCP, it is not required
to do an “OPEN” for the connection to be established. The WiSnap module acts like a data-pipe, so the UART data will be sent