User manual

Local Terminal
A command like crossConnect(DS_UART0, DS_STDIO) will send characters received on UART0 to your
SNAPpy script for processing. The characters will be reported to your script via your specified HOOK_STDIN
handler. Any text “printed” (using the print statement) will be sent out that same serial port.
This makes it possible to implement applicaons like a Command Line Interface.
Remote Terminal
A command like crossConnect(DS_TRANSPARENT, DS_STDIO) will send characters received wirelessly to
your SNAPpy script for processing. Characters “printed” by your SNAPpy script will be sent back out over the air.
This is oen used in conjuncon with a
crossConnect(DS_UARTx, DS_TRANSPARENT) in some other SNAP
Node.
Packet Serial
The last column of the table shows the effect of various combinaons using DS_PACKET_SERIAL.
A command like
crossConnect(DS_UART0, DS_PACKET_SERIAL) will configure the unit to talk Synapse’s
Packet Serial protocol over UART0. This enables RS-232 connecon to a PC running Portal or SNAP Connect.
It also allows serial connecon to another SNAP Node, if the appropriate “cross-over” cable is used.
This allows “bridging” of separate SNAP Networks (networks that are on different channels and/or different
Network IDs, or two nodes that work in different radio frequency ranges).
A command like
crossConnect(DS_UART1, DS_PACKET_SERIAL) will configure the unit to talk Synapse’s
Packet Serial protocol over UART1. On some SNAP demonstraon boards, one UART will be a true RS-232 serial
connecon, and the other will be a USB serial connecon.
Refer to the API documentaon on crossConnect() in the SNAP Reference Manual for more details.
Debugging
Applicaon development with SNAP offers an unprecedented level of interacvity in embedded programming.
Using Portal you can quickly upload code, test, adjust, and try again. Some ps and techniques for debugging:
Make use of the “print” statement to verify control flow and values. (Be sure to connect STDIO to a
UART or Intercept STDOUT with Portal.)
When using Portal’s Intercept feature, you’ll get source line-number informaon, and symbolic error-
codes.
Invoke “unit-test” script funcons by execung them directly from the Snappy Modules Tree in Portal’s
Node Info panel.
Use the included SNAP Sniffer to observe the RPC calls between devices.
SNAP® Network Operang System 23