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:
Parameter | Value |
Data Rate | 38400 bps |
Data Bits | 8 |
Parity | None |
Stop Bits | 1 |
Flow Control | Hardware |
Node | DIP switches | ||
---|---|---|---|
SW4:1 | SW4:2 | SW4:3 | |
0 | OFF | OFF | OFF |
1 | ON | OFF | OFF |
2 | OFF | ON | OFF |
3 | ON | ON | OFF |
4 | OFF | OFF | ON |
5 | ON | OFF | ON |
6 | OFF | ON | ON |
7 | ON | ON | ON |
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
LEDs indicate network activity as follows:
APP_CHANNEL_MASK | Specifies channels to be tried by nodes for network operation |
APP_COORD_UID | Coordinator UID; is used as coordinator MAC address |
APP_USE_APS_ACK | Indicates whether the APS level ack will be used or not |
TIMER_STARTING_NETWORK | LED blinking interval during network start (ms) |
TIMER_FW_DELAY | Interval before forwarding of the received packet (ms) |
The source codes of Peer-to-peer application are located at