Peer-to-peer Application

This sample shows how to organize the simplest peer-to-peer link. A simple buffering strategy is employed to avoid byte-by-byte data transfer.

At least 2 nodes are participating. Up to 8 nodes can be engaged. In order to define the node logical addresses, set DIP switches as shown below. One of the nodes should be configured as coordinator (i.e. its logical address should be set to zero). All of the nodes which are connected over UART to their own USB ports simply exchange over UART with data sent to them by their hosts. The connection parameters should be set in the following way:
ParameterValue
Data Rate38400 bps
Data Bits8
ParityNone
Stop Bits1
Flow ControlHardware
The nodes communicate strictly in pairs defined by their logical addresses as follows:

NodeDIP switches
SW4:1SW4:2SW4:3
0OFFOFFOFF
1ONOFFOFF
2OFFONOFF
3ONONOFF
4OFFOFFON
5ONOFFON
6OFFONON
7ONONON

The network organizes automatically on startup. You may connect two devices to a PC (or to different PCs, thus introducing a rough functional equivalent of an instant messenger), start two instances of HyperTerminal, type some message in one terminal window and observe it appearing in the another.

Pressing SW1 button on a node results in sending a single maximum-length frame filled with 0xDD byte.

LEDs indicate network activity as follows:

Configuration parameters

APP_CHANNEL_MASKSpecifies channels to be tried by nodes for network operation
APP_COORD_UIDCoordinator UID; is used as coordinator MAC address
APP_USE_APS_ACKIndicates whether the APS level ack will be used or not
TIMER_STARTING_NETWORKLED blinking interval during network start (ms)
TIMER_FW_DELAYInterval before forwarding of the received packet (ms)

The source codes of Peer-to-peer application are located at [ZDK]\Sample Applications\Peer2peer directory.


Generated on Tue Mon Oct 6 16:59:43 2008 for BitCloud Stack Documentation by  doxygen 1.5.1-p1