Specifications

We want to implement a point-to-point bidirectional link
We don’t want to make any changes to the original endpoints (other than cabling)
This is clearly a good fit for the Transparent Mode feature of SNAPpy, but there are still choices to
be made around “how will the nodes know who to talk to?”
Option 1 – Two Scripts, Hardcoded Addressing
A script named dataMode.py is included in the set of example scripts that ships with Portal. Because it
is one of the demo scripts, it is write-protected. Using Portal’s “Save As” feature, create two copies of
this script (for example, dataModeA.py and dataModeB.py). You can then edit each script to specify
the other node’s address, before you upload both scripts into their respective nodes.
The full text of dataMode.py is shown below. Notice this script is only 19 lines long, and 8 of those
lines are comments (and 3 are just whitespace).
"""
Example of using two SNAP wireless nodes to replace a RS-232 cable
Edit this script to specify the OTHER node's address, and load it into a node
Node addresses are the last three bytes of the MAC Address
MAC Addresses can be read off of the SNAP Engine sticker
For example, a node with MAC Address 001C2C1E 86001B67 is address 001B67
In SNAPpy format this would be address "\x00\x1B\x67"
"""
from synapse.switchboard import *
otherNodeAddr = "\x4B\x42\x35" # <= put the address of the OTHER node here
@setHook(HOOK_STARTUP)
def startupEvent():
initUart(1, 9600) # <= put your desired baud rate here!
flowControl(1, False) # <= set flow control to True or False as needed
crossConnect(DS_UART1, DS_TRANSPARENT)
ucastSerial(otherNodeAddr)
The script as shipped defaults to 9600 baud and no hardware flow control. Edit these settings as
needed, too.
With these two edited scripts loaded into the correct nodes (remember, you are telling each node who
the other node is, each node already knows its own address), you have just created a wireless serial
link.
Option 2 – One Script, Manually Configurable Addressing
Instead of hard-coding the “other node” address within each script, you could have both nodes share a
common script, and use SNAPpy’s Non-Volatile Parameter (NV Param for short) support to specify
the addressing, after the script was loaded into the unit.
Look in your snappyImages directory for a script named dataModeNV.py. Since we won’t be making
any changes to this script, there is no need to make a copy of it. Simply load it into both nodes as-is.
SNAP Reference Manual Document Number 600-0007K Page 31 of 202