CYFISNP_001-48033.pdf

CyFi™ Star Network Protocol Stack Datasheet CYFISNP V 2.00
001-48033 Rev. *F
CyFi™ Star Network Protocol Stack Datasheet
Copyright © 2009-2013 Cypress Semiconductor Corporation. All Rights Reserved.
API Memory (Bytes)
Resources
CY7C601/602xx,
CYRF69x13,
CYRF89235,
CYRF89435
enCoRe™ Blocks
Flash
SPI
7416a
RAM
87
Pins (per
External I/O)
5
a. The CYFISNP user module is written in C, so the code space required in flash is variable and dependent on your choice of compiler and the code that you write for your implementation.
Features and Overview
„ Protocol stack that implements node functionality to support a wireless star network consisting of one
hub and up to 250 nodes
„ Provides reliable two way communication between a hub and node
„ Dynamic data rate (up to 1 Mbps) and output power according to the channel noise level and packet
loss rate
„ Operates in the unlicensed worldwide Industrial, Scientific, and Medical (ISM) band (2.400–2.483GHz)
The CyFi™ Star Network Protocol Stack (CYFISNP) User Module is designed to address up to 250
general purpose nodes; it provides reliable two way communication between the hub and node(s). The
hub is assumed to be wall powered, while the nodes may be either wall powered or powered by an
alkaline (low impedance) or coin-cell (high impedance) battery.
Figure 1.
Block Diagram
Cypress Semiconductor Corporation
Document Number: 001-48033 Rev. *F
•
198 Champion Court
•
San Jose, CA 95134-1709
•
408-943-2600
Revised May 24, 2013
CyFi™ Star Network Protocol Stack Datasheet
Functional Description
Node: A PSoC device with a radio and other hardware that reports data wirelessly to a hub.
Hub: A PSoC device with a radio that receives data wirelessly from one or more nodes.
Device: Either a hub or a node. The plural form, devices, refers to both hub and node.
Manufacturing ID: Each CyFi radio modem contains a 4-byte manufacturing ID (MID) that has been laser
fused into the radio silicon during manufacturing.
Addressing: Every node in a Star Network has an 8-bit device ID that ranges from 1 to 250 (Device ID 0
is reserved). The Device ID uniquely identifies a particular node and is passed to the application as part of
the packet structure. When initially connecting, a node may either request that a Device ID be assigned by
the hub (on-the-fly assignment), or the node may specify its own device ID (preassigned device ID). A
single network can either support on-the-fly device ID assignment or preassigned device ID, but not a mix
of both.
The device ID is passed up to the application (either in the PSoC or software application) as part of the
payload.
See the Operation Reference section at the end of the datasheet for a more complete description of the
protocol.
Placement
The SPI block of the user module may be placed on the fixed function SPI block.
Parameters and Resources
Node Specific Parameters
Node Power Supply Type
Defines if the node has a limited power source as in the case of a coin cell.
Available values:
Wall powered: The device idles in receive mode.
Low impedance (alkaline) battery powered: The battery has sufficiently low internal resistance to
power the node continuously when needed. Node idles in sleep to conserve power.
High impedance (coin-cell) battery powered: The battery can only power node for a few milliseconds and then must have several hundred milliseconds of sleep to recover. As a consequence, these
nodes have slower recovery from radio packet losses. Node idles in sleep to conserve power.
EEPROM Block
This parameter defines the flash block number used to store network parameters. A Node device uses
one flash block. This block must be marked as unprotected in the flashsecurity.txt file.
External PA
This parameter controls operation of external power amplifier. Choose Yes or No to indicate whether
your project uses an external PA.
Document Number: 001-48033 Rev. *F
Page 2 of 36
CyFi™ Star Network Protocol Stack Datasheet
MUX IRQ on MOSI
The CYRF793x device IRQ function may be multiplexed onto the MOSI pin. The table below shows
the operation when this parameter is enabled.
Table 1.
MUX IRQ on MOSI Enabled
SS Signal
Result
HIGH
The MOSI pin on the PSoC is in High Z state and is used as an IRQ input.
LOW
The MOSI pin on the PSoC is operated in a strong drive mode and performs
the MOSI output function.
Clock
Selects the SPIM block clock divider. The clock divider is applied to the CPUCLK to generate the SPI
Clock.
ClockDivider
SCLK
Select
SCLK Frequency when:
CPUCLK = 12 MHz
CPUCLK = 24 MHz
6
00
2 MHz
4 MHz
12
01
Do Not Use
2 MHz
48
10
Do Not Use
Do Not Use
The ClockDivider parameter programs the SCLK Select field of the SPI Configuration Register
(SPICR).
Note
The node and hub can have different SPI clock and CPU_CLK clock rates, but the only SPI clock
rates fully tested are 2, 2.4, 3, and 4 Mbps. The CPU clock rates can be different but both must be
at least 3 MHz.
SPI Mode
The SPI Mode User Module Parameter selects the pins used by the SPI block. The parameter allows
three wire (SDIO/SCK) or four wire (MOSI/MISO/SCLK) operation.
IRQ_Port, IRQ_Pin
Selects the IRQ pin. This pin must be connected to the IRQ pin of the CYRF793x device.
nSS_Port, nSS_Pin
Selects the SlaveSelect pin. This output line must be connected to the SS pin on the radio.
First Channel
This parameter controls the low limit of the RF channel range used by the CYFISNP protocol to ensure
regulatory compliance by preventing or reducing out-of-band RF emissions that may occur depending
on RF circuitry design (for example, nonlinearities in an external power amplifier may cause out-ofband RF emissions).
Last Channel
This parameter controls the low limit of the RF channel range used by the CYFISNP protocol so as to
ensure regulatory compliance by preventing or reducing out-of-band RF emissions that may occur
Document Number: 001-48033 Rev. *F
Page 3 of 36
CyFi™ Star Network Protocol Stack Datasheet
depending on RF circuitry design (for example, nonlinearities in an external power amplifier may
cause out-of-band RF emissions).
Interrupt Generation Control
There are two additional parameters that become available when the Enable interrupt generation
control check box in PSoC Designer is checked. This is available under Project > Settings > Chip
Editor. Interrupt Generation Control is important when multiple overlays are used with interrupts shared
by multiple user modules across overlays:
„ Interrupt API
„ IntDispatchMode
InterruptAPI
The InterruptAPI parameter allows conditional generation of a user module’s interrupt handler and
interrupt vector table entry. Select “Enable" to generate the interrupt handler and interrupt vector table
entry. Select “Disable" to bypass the generation of the interrupt handler and interrupt vector table
entry.
Pay particular attention to this if your project has multiple overlays where a single block resource is
used by the different overlays. Choose to generate interrupts only for the overlays that actually need
them to conserve code space.
IntDispatchMode
The IntDispatchMode parameter is used to specify how an interrupt request is handled for interrupts
shared by multiple user modules existing in the same block but in different overlays. When you select
ActiveStatus the firmware tests that overlay are active before servicing the shared interrupt request.
This test occurs every time the shared interrupt is requested. This adds latency and also produces a
nondeterministic procedure for servicing shared interrupt requests, but does not require any RAM.
When you select OffsetPreCalc the firmware calculates the source of a shared interrupt request only
when an overlay is initially loaded. This calculation decreases interrupt latency and produces a deterministic procedure for servicing shared interrupt requests, but at the expense of a byte of RAM.
CYFISNP_Config.h
Each time a user module is placed, it is assigned an instance name. By default, PSoC Designer assigns
the CYFISNP_1 to the first instance of this user module in a given project. The assigned instance name
becomes the prefix of every global function name, variable, and constant symbol. It is also used as the
prefix on file names if the same file name is used by multiple user modules (config.h, for example). In this
document, this prefix is shortened to CYFISNP for simplicity.
The CYFISNP User Module generates a file named CYFISNP_Config.h that contains tables and variables
that you can configure for your project. Most code in the generated header and source files in your project
is regenerated each time your project is built, and any changes that you make to this code are lost. The
exceptions to this rule are sections of code contained between @PSoC_UserCode_name@ and
@PSoC_UserCode_END@. You can make changes to the following items in CYFISNP_Config.h.
Document Number: 001-48033 Rev. *F
Page 4 of 36
CyFi™ Star Network Protocol Stack Datasheet
@PSoC_UserCode_PaPhyTblInternal@
@PSoC_UserCode_PaPhyTblExternal@
This table allows you to customize the 8 possible RF power steps for the Dynamic PA feature. This list
should be monotonic for proper operation. The internal table is used if the External PA parameter is set to
No. The external table is used if it is set to Yes.
@PSoC_UserCode_PaLevelBind@
This section allows you to set the CYFISNP_PA_LEVEL_BIND variable that allows you to change the PA
level used during binding. Changing the PA level influences the binding distance.
Variable
Value
PA0
Typically -35 dBm
PA1
Typically -30 dBm
PA2
Typically -24 dBm
PA3
Typically -18 dBm
PA4
Typically -13 dBm
PA5
Typically -5 dBm
PA6
Typically 0 dBm
PA7
Typically +4 dBm
Usable Only if an External PA is Installed
PA0_PLUS
Typically external PA gain + -35 dBm
PA1_PLUS
Typically external PA gain + -30 dBm
PA2_PLUS
Typically external PA gain + -24 dBm
PA3_PLUS
Typically external PA gain + -18 dBm
PA4_PLUS
Typically external PA gain + -13 dBm
PA5_PLUS
Typically external PA gain + -5 dBm
PA6_PLUS
Typically external PA gain + 0 dBm
PA7_PLUS
Typically external PA gain + 4 dBm
CPU Requirements
The CPU clock rate must be greater than or equal to 3 MHz.
Document Number: 001-48033 Rev. *F
Page 5 of 36
CyFi™ Star Network Protocol Stack Datasheet
Application Programming Interface
The Application Programming Interface (API) routines are provided as part of the user module to allow the
designer to deal with the module at a higher level. This section specifies the interface to each function
together with related constants provided by the include files.
Each time a user module is placed, it is assigned an instance name. By default, PSoC Designer assigns
the CYFISNP_1 to the first instance of this user module in a given project. It can be changed to any unique
value that follows the syntactic rules for identifiers. The assigned instance name becomes the prefix of
every global function name, variable and constant symbol. In the following descriptions the instance name
has been shortened to CYFISNP for simplicity.
Note
In this, as in all user module APIs, the values of the A and X register may be altered by calling an
API function. It is the responsibility of the calling function to preserve the values of A and X before
the call if those values are required after the call. This “registers are volatile" policy was selected
for efficiency reasons and has been in force since version 1.0 of PSoC Designer. The C compiler
automatically takes care of this requirement. Assembly language programmers must ensure their
code observes the policy, too. Though some user module API function may leave A and X
unchanged, there is no guarantee they may do so in the future.
Note
ImageCraft compiler optimizations, such as data flow optimization, condensation, and sublimation
do not work well with this user module. If you use the ImageCraft compiler, choose Project > Settings > Compiler and make sure that the optimizations are disabled for this project.
These functions provide configuration, transmit and receive functionality.
CYFISNP_Start
Description:
Configures protocol. May be called multiple times.
C Prototype:
BYTE CYFISNP_Start(void);
Parameters:
None
Return Value:
A return value of 0 indicates failure.
A return value of 1 indicates success.
Side Effects:
None
CYFISNP_Stop
Description:
Stops the protocol, call CYFISNP_Start() to resume Protocol. Any radio activity is Timed-Out and the
radio is placed in a minimum current state.
C Prototype:
void CYFISNP_Stop(void);
Document Number: 001-48033 Rev. *F
Page 6 of 36
CyFi™ Star Network Protocol Stack Datasheet
Parameters:
None
Return Value:
None
Side Effects:
None
CYFISNP_Run
Description:
Normally called as part of a main polling loop.
NODE: When called, a Forward Channel transmission and/or reception may occur. During transmit
retries, a retransmission occurs with each call to Run(), thus retransmission spacing is directly regulated by the Application. This applies to all retransmissions (Data, Bind, Connect, Ping, and more).
HUB: When called a Back Channel transmission/retransmission may occur to wall-powered Nodes.
Back Channel Data (BCD) to battery powered Nodes is handled through an ISR because of required
BCD synchronization to arriving Forward Channel Data.
C Prototype:
void CYFISNP_Run(void);
Parameters:
None
Return Value:
None
Side Effects:
None
CYFISNP_Jog
Description:
Rouse radio from timeout mode. Timeout mode means Hub contact is lost. Either User intervention
is required or a low-frequency automated recovery is invoked. Timeout exists to preserve the battery
and minimize RF emissions (good neighbor) when the Node is out of range of the Hub.
C Prototype:
void CYFISNP_Jog(void);
Parameters:
None
Return Value:
None
Side Effects:
None
Document Number: 001-48033 Rev. *F
Page 7 of 36
CyFi™ Star Network Protocol Stack Datasheet
CYFISNP_BindStart
Description:
Change to dedicated Bind network parameters and attempt to locate and bind. For a Node, binding
consists of attempting to locate a receptive Hub by transmitting Bind Requests on the Bind channels.
For a Hub, binding consists of listening on an acceptable Bind channel. Node binding automatically
stops when the node is bound or when it times out. Hub binding automatically stops as soon as hub
binds to one node or when it times out.
C Prototype:
void CYFISNP_BindStart(BYTE reqDevId);
Parameters:
reqDevId is zero if the node is requesting on-the-fly ID assignment, otherwise it is a number between
1 and MAX_NODES.
Return Value:
None
Side Effects:
None
CYFISNP_Unbind
Description:
Unbind the device. May be called anytime.
C Prototype:
void CYFISNP_Unbind(void);
Parameters:
DevID: Device ID to unbind.
Return Value:
None
Side Effects:
None
CYFISNP_GetNodeID
Description:
Returns Device ID, zero if this MID has no Device ID. This data is also visible directly in the flash data
structure.
C Prototype:
BYTE CYFISNP_GetNodeID(void);
Parameters:
MID: Manufacturer ID to lookup for
Document Number: 001-48033 Rev. *F
Page 8 of 36
CyFi™ Star Network Protocol Stack Datasheet
Return Value:
Returns Device Identifier of the device with given MID
Side Effects:
None
CYFISNP_LookupDevId (Legacy)
Description:
Returns Device ID, zero if this MID has no Device ID. This data is also visible directly in the flash data
structure.
C Prototype:
BYTE CYFISNP_LookupDevId(void);
Parameters:
MID: Manufacturer ID to lookup for
Return Value:
Returns Device Identifier of the device with given MID
Side Effects:
None
CYFISNP_RxDataPend
Description:
Returns TRUE if a receive API packet is pending.
C Prototype:
BOOL CYFISNP_RxDataPend(void);
Parameters:
None
Return Value:
BOOL: TRUE if a receive API packet is pending
Side Effects:
None
CYFISNP_RxDataGet
Description:
This function should only be called when CYFI_RxDataPend() returns TRUE. Returns a pointer,
pStruct, that points to the received packet.
C Prototype:
CYFISNP_API_PKT * CYFISNP_RxDataGet(void);
Parameters:
pStruct: pointer to CYFISNP_API_PKT structure
Document Number: 001-48033 Rev. *F
Page 9 of 36
CyFi™ Star Network Protocol Stack Datasheet
Return Value:
BOOL: TRUE if Data is copied into user buffer.
Side Effects:
None
CYFISNP_RxDataRelease
Description:
Free API packet buffer from prior CYFISNP_RxDataGet(). Node has one receive buffer, so backchannel-data is blocked until the API buffer is released.
C Prototype:
void CYFISNP_RxDataRelease(void);
Parameters:
None
Return Value:
None
Side Effects:
None
CYFISNP_TxDataPend
Description:
Returns TRUE when transmit data is pending and FALSE otherwise.
C Prototype:
BOOL CYFI_TxDataPend(char devId)
Parameters:
DevID: Device identifier. Hub may have 1 Tx buffer per Device, so the Hub must specify a valid a
Device ID, the Node parameter is void.
Return Value:
TRUE of transmit data is pending.
Side Effects:
None
CYFISNP_TxDataPut
Description:
Pass Tx Data buffer to Protocol. Returns FALSE if unable to send to Device. Call
CYFISNP_TxDataPend() to determine when API buffer is released (data transmission(s) are
complete).
C Prototype:
BOOL CYFISNP_TxDataPut(CYFISNP_API_PKT *pStruct);
Document Number: 001-48033 Rev. *F
Page 10 of 36
CyFi™ Star Network Protocol Stack Datasheet
Parameters:
pStruct: pointer to CYFISNP_API_PKT structure
Return Value:
BOOL: FALSE if unable to send Data to Device.
Side Effects:
None
CYFISNP_TimeSet
Description:
Initializes the software one-shot timer.
C Prototype:
void CYFISNP_TimeSet(WORD *pTimer, WORD time);
Parameters:
pTimer: Pointer to a WORD variable that defines the timer object. This variable is used internally by
the CYFISNP_TimeSet and CYFISNP_TimeExpired functions.time: Timer expiration period, in ticks.
Tick rate is 64 ticks per second. The maximum value of time is 0x7FFF ticks in the future.
Return Value:
BOOL: FALSE if unable to send Data to Device.
Side Effects:
None
CYFISNP_TimeExpired
Description:
Checks if specified timer expired. The function must be called within 0x7FFF ticks of when
CYFISNP_TimeSet() was called.
C Prototype:
BOOL CYFISNP_TimeExpired(WORD *pTimer);
Parameters:
pTimer: Pointer to a WORD variable that defines the timer object. This variable is used internally by
the CYFISNP_TimeSet and CYFISNP_TimeExpired functions.
Return Value:
BOOL: TRUE if timer expired, FALSE otherwise.
Side Effects:
None
Document Number: 001-48033 Rev. *F
Page 11 of 36
CyFi™ Star Network Protocol Stack Datasheet
CYFISNP_GetDieTemp
Description:
User modifiable function to return die temperature (in degrees C) for flash writing during binding. This
function returns 20 by default.
C Prototype:
BYTE CYFISNP_GetDieTemp(void);
Parameters:
None
Return Value:
BYTE: Die temperature in Celsius degree.
Side Effects:
None
API Structures
CYFISNP_API_PKT
Prototype:
typedef struct {
BYTE length;
BYTE rssi;
BYTE type;
BYTE devId;
BYTE payload[CYFISNP_FCD_PAYLOAD_MAX];
} CYFISNP_API_PKT;
Members:
length: Payload size in bytesrssi: Receive Signal Strength Indicator. A value in the range 0..31.type:
Type of the packet. Can have one of the following values:
Constant
Description
CYFISNP_API_TYPE_NULL
Empty packet
CYFISNP_API_TYPE_BIND_RSP_ACK
Bind Response delivered
CYFISNP_API_TYPE_CONF
Delivery confirmation, no BCDR
CYFISNP_API_TYPE_CONF_BCDR
Delivery confirmation, BCDR present
CYFISNP_API_TYPE_SYNC
Best effort, no BCDR
CYFISNP_API_TYPE_SYNC_BCDR
Best effort, BCDR present
CYFISNP_API_TYPE_PING
Ping from some Node
CYFISNP_API_TYPE_BAD_DEV
Bad devID indication
CYFISNP_API_TYPE_UNKNOWN
Unknown packet
Document Number: 001-48033 Rev. *F
Page 12 of 36
CyFi™ Star Network Protocol Stack Datasheet
devId: Device Identifierpayload: Data
CYFISNP_eProtState
Prototype
typedef enum {
CYFISNP_BIND_MODE
= 0x10,
CYFISNP_UNBOUND_MODE
= 0x11,
CYFISNP_CON_MODE
= 0x20,
CYFISNP_CON_MODE_TIMEOUT
= 0x21,
CYFISNP_PING_MODE
= 0x30,
CYFISNP_PING_MODE_TIMEOUT
= 0x31,
CYFISNP_DATA_MODE
= 0x40,
CYFISNP_STOP_MODE
= 0x50
} CYFISNP_PROT_STATE;
CYFISNP_PROT_STATE CYFISNP_eProtState;
Description
CYFISNP_eProtState enumeration holds current Protocol State. Possible values are described in
following table:
Value
Description
CYFISNP_BIND_MODE
Device is in BIND mode
CYFISNP_UNBOUND_MODE
Device is unbound or was not bound previously (Node only)
CYFISNP_CON_MODE
Device is in CONNECT mode (Node only)
CYFISNP_CON_MODE_TIMEOUT
CONNECT Mode timed out (Node only)
CYFISNP_PING_MODE
Device is on PING mode
CYFISNP_PING_MODE_TIMEOUT
PING mode timed out (Node only)
CYFISNP_DATA_MODE
Device is in DATA mode
CYFISNP_STOP_MODE
Protocol is stopped (CYFISNP_Stop was called)
Document Number: 001-48033 Rev. *F
Page 13 of 36
CyFi™ Star Network Protocol Stack Datasheet
Sample Code
The following sample code demonstrates binding and data transfer between HUB and NODE. It is
designed for PDC-9287-*B boards but can be used on any other board.
NODE Sample Code
//-------------------------------------------------------------------------//
// Sample Node Application
//
// 1) SPI is configured for 2 to 3 MHz (but should be about same as the Hub)
// 2) TX8 block is used here for debugging by a CYFISNP_DEBUG macro define
//
(CYFISNP_DEBUG also triggers some debug data within the SNP UM)
// 3) Assumes you've renamed SNP User Module "CYFISNP".
// 4) Assumes you've various I/O {LED1, LED2, SW1, SW2}
// 5) GRN LED is blinking "running".
// 6) RED LED is Binding or sending a packet.
//
//-------------------------------------------------------------------------#include <m8c.h>
// part specific constants and macros
#include "PSoCAPI.h"
// PSoC API definitions for all User Modules
#include "psocGpioInt.h"
//-----------------------------------------// SW1 >> Port_0_3
// SW2 >> Port_0_4
// LED1 >> Port_0_0
// LED2 >> Port_0_1
//
// Address of P0DATA register = 0
//
// Base Part : CY7C63803-SXC
//-----------------------------------------#pragma ioport SW1_Data_ADDR: 0x0
BYTE SW1_Data_ADDR;
#pragma ioport SW2_Data_ADDR: 0x0
BYTE SW2_Data_ADDR;
#pragma ioport LED1_Data_ADDR: 0x0
BYTE LED1_Data_ADDR;
#pragma ioport LED2_Data_ADDR: 0x0
BYTE LED2_Data_ADDR;
//----------------------------------------#define SWITCHES_ACTIVE_HIGH
#define
#define
#define
#define
#define
LED_RED_ON
LED_RED_OFF
LED_GRN_ON
LED_GRN_OFF
LED_RED_TOG
0
(LED1_Data_ADDR
(LED1_Data_ADDR
(LED2_Data_ADDR
(LED2_Data_ADDR
(LED1_Data_ADDR
Document Number: 001-48033 Rev. *F
// 0 = Active LOW, 1 = Active HIGH
&= ~LED1_MASK)
|= LED1_MASK)
&= ~LED2_MASK)
|= LED2_MASK)
^= LED1_MASK)
//
//
//
//
Active
Active
Active
Active
LOW
LOW
LOW
LOW
LED
LED
LED
LED
Page 14 of 36
CyFi™ Star Network Protocol Stack Datasheet
#define LED_GRN_TOG
(LED2_Data_ADDR ^=
#define LED_BLINK_TIME
WORD ledTimer;
(125 / CYFISNP_TIMER_UNITS) // 125mS toggle time
#define REPORT_TIME
#define COIN_CELL_TIME
WORD reportTimer;
WORD coinCellTimer;
(125 / CYFISNP_TIMER_UNITS) // New Tx Data @ 125mS
( 50 / CYFISNP_TIMER_UNITS) // CYFISNP_Run() @ 50mS
// Local functions
static void putNewTxMsg
static void showRxPkt
static BOOL checkBindButton
static BOOL checkJogButton
static void showSignon
LED2_MASK)
(void);
(void);
(void);
(void);
(void);
// Local variables
static CYFISNP_API_PKT txApiPkt;
static CYFISNP_API_PKT *pRxApiPkt;
// Local Tx Data buffer
// Ptr to Rx API packet
// ------------------------------------------------------------------------//
// main() - Powerup entry
//
// ------------------------------------------------------------------------void main()
{
char ivar;
CYFISNP_PROT_STATE eProtStateOld = CYFISNP_STOP_MODE;
LED_RED_OFF;
LED_GRN_OFF;
#ifdef CYFISNP_DEBUG
TX8_Start(TX8_PARITY_NONE);
#endif
showSignon();
// Start the debug Tx UART.
// --------------------------------------------------------------------// Startup CYFISNP
// --------------------------------------------------------------------while (CYFISNP_Start() == 0) {
CYFISNP_OutStr("Failed to initialize CYFISNP");
}
M8C_EnableGInt;
// CYFISNP uses Sleep Timer interrupt
// Set some local timers for sample application operation
CYFISNP_TimeSet(&ledTimer, LED_BLINK_TIME);
CYFISNP_TimeSet(&reportTimer, REPORT_TIME);
CYFISNP_TimeSet(&coinCellTimer, COIN_CELL_TIME);
// Initialize Tx Data with "ABCD...."
for (ivar=0; ivar < CYFISNP_FCD_PAYLOAD_MAX; ++ivar) {
txApiPkt.payload[ivar] = 'A' + ivar;
Document Number: 001-48033 Rev. *F
Page 15 of 36
CyFi™ Star Network Protocol Stack Datasheet
}
// --------------------------------------------------------------------//
// POLLING LOOP
//
// --------------------------------------------------------------------for (;;) {
// ----------------------------------------------------------------// Blink the periodic "running" LED
// ----------------------------------------------------------------if (CYFISNP_TimeExpired(&ledTimer)) {
LED_GRN_TOG;
CYFISNP_TimeSet(&ledTimer, LED_BLINK_TIME);
}
//
//
//
if
----------------------------------------------------------------Start Binding as needed
----------------------------------------------------------------(checkBindButton()) {
CYFISNP_BindStart(0);
// 0 = on-the-fly ID assignment
}
//
//
//
if
----------------------------------------------------------------Keep Tx buffer full for testing.
----------------------------------------------------------------(CYFISNP_TimeExpired(&reportTimer)
// If timer expired
&& CYFISNP_eProtState
== CYFISNP_DATA_MODE // AND in Data Mode
&& CYFISNP_TxDataPend() == FALSE) {
// AND no Tx pending
putNewTxMsg();
// Post Tx message
CYFISNP_TimeSet(&reportTimer, REPORT_TIME); // Report interval
}
//
//
//
//
//
//
//
//
//
//
if
----------------------------------------------------------------Run SNP state machine.
Each call to CYFISNP_Run() may result in up to 1 transmit/receive
event (or it may result in nothing). Worst-case it should ret
within 4 mS (unless it it's writing FLASH during a Bind event).
CYFISNP_Run can be called every 100 mS to give coin-cell powered
node time to recover (although response times will be slower).
----------------------------------------------------------------(CYFISNP_TimeExpired(&coinCellTimer)) {
CYFISNP_TimeSet(&coinCellTimer, COIN_CELL_TIME);
CYFISNP_Run();
// Poll SNP machine
//
//
//
if
------------------------------------------------------------If got Rx packet, then process/show it
------------------------------------------------------------(CYFISNP_RxDataPend()) {
pRxApiPkt = CYFISNP_RxDataGet();
showRxPkt();
CYFISNP_RxDataRelease();
// Must release buffer when done
}
Document Number: 001-48033 Rev. *F
Page 16 of 36
CyFi™ Star Network Protocol Stack Datasheet
//
//
//
if
------------------------------------------------------------Monitor SNP overall state, maybe drive an user indicator
------------------------------------------------------------(eProtStateOld != CYFISNP_eProtState) {
switch (CYFISNP_eProtState) {
// --------------------------------------------------------case CYFISNP_BIND_MODE:
LED_RED_ON;
// Show an indication when in BIND Mode
break;
// --------------------------------------------------------case CYFISNP_CON_MODE_TIMEOUT:
// you can show an "OUT-OF-RANGE" indication here
//
//
//
//
//
//
//
//
if
----------------------------------------------------When "out-of-range", the application decides how
often to attempt recovery. If someone walks away
with a node in their pocket, you may not want to
attempt recover as often or you may want user
intervention (ie: button push) to attempt recovery.
CYFISNP_Jog() attempts recovery.
----------------------------------------------------(checkJogButton()) { // User intervention
CYFISNP_Jog();
// Retry SNP connection
}
break;
// --------------------------------------------------------case CYFISNP_DATA_MODE:
// you can show an "everything is GOOD" indicator here
break;
// --------------------------------------------------------case CYFISNP_STOP_MODE:
// Unbound idle
LED_RED_OFF;
// Show an indication if STOPPED
break;
}
eProtStateOld = CYFISNP_eProtState;
}
}
// End calling CYFISNP_Run()
}
}
// ------------------------------------------------------------------------//
// showRxPkt()
//
// ------------------------------------------------------------------------static void showRxPkt(void) {
char ivar;
CYFISNP_OutStr("\n\r");
CYFISNP_OutStr(",");
CYFISNP_OutStr(",");
CYFISNP_OutStr(",");
CYFISNP_OutStr(":");
Document Number: 001-48033 Rev. *F
CYFISNP_OutHex(pRxApiPkt->length);
CYFISNP_OutHex(pRxApiPkt->rssi);
CYFISNP_OutHex(pRxApiPkt->type);
CYFISNP_OutHex(pRxApiPkt->devId);
Page 17 of 36
CyFi™ Star Network Protocol Stack Datasheet
// Show Rx data packets in ASCII
if (pRxApiPkt->type == CYFISNP_API_TYPE_CONF
|| pRxApiPkt->type == CYFISNP_API_TYPE_SYNC) {
for (ivar=0; ivar != pRxApiPkt->length; ++ivar) {
CYFISNP_OutChar(pRxApiPkt->payload[ivar]);
}
} else { // Show anything else as HEX
for (ivar=0; ivar != pRxApiPkt->length; ++ivar) {
CYFISNP_OutHex(pRxApiPkt->payload[ivar]);
CYFISNP_OutChar(' ');
}
}
}
// ------------------------------------------------------------------------// Change the Tx data for fun
// ------------------------------------------------------------------------static void shiftTxData(void) {
char ivar;
char oldval;
oldval = txApiPkt.payload[0];
for (ivar=0; ivar < CYFISNP_FCD_PAYLOAD_MAX; ++ivar) {
txApiPkt.payload[ivar] = txApiPkt.payload[ivar+1];
}
txApiPkt.payload[ivar-1] = oldval;
}
// ------------------------------------------------------------------------//
// putNewTxMsg() - Battery nodes send a user packet to the HUB.
//
// ------------------------------------------------------------------------static void putNewTxMsg(void)
{
static char txPktSz;
static char pktType;
volatile WORD delay;
LED_RED_ON;
for (delay=0; delay < 2000; ++delay);
// Very fast pulse RED LED
LED_RED_OFF;
if (++txPktSz > CYFISNP_FCD_PAYLOAD_MAX)
txPktSz = 1;
// Vary Tx packet size for fun
// --------------------------------------------------------------------// Set Back Channel Data Request bit.
// A wall-powered node idles in receive, so it doesn't set BCDR bit
// A battery-powered node may or may not, depending on whether it
// expects to receive data and is willing to keep the radio powered for
//
an extra 2 mS.
// --------------------------------------------------------------------#if (CYFISNP_PWR_TYPE == CYFISNP_PWR_WALL)
pktType = CYFISNP_API_TYPE_CONF;
// Wall powered node idle in Rx
#else
pktType = CYFISNP_API_TYPE_CONF_BCDR;
// optional: expect Rx data
Document Number: 001-48033 Rev. *F
Page 18 of 36
CyFi™ Star Network Protocol Stack Datasheet
#endif
shiftTxData();
txApiPkt.length = txPktSz;
txApiPkt.type
= pktType;
CYFISNP_TxDataPut(&txApiPkt);
// Change the test data for fun.
// Specify Tx length
}
// ------------------------------------------------------------------------// checkBindButton()
// ------------------------------------------------------------------------#define DEBOUNCE_TIME
(25/CYFISNP_TIMER_UNITS)
// about 25 mS
static BOOL bindButtonIsOn(void) {
#if SWITCHES_ACTIVE_HIGH
SW1_Data_ADDR &= ~SW1_MASK;
// Ensure GPIO pulldown active
return((SW1_Data_ADDR & SW1_MASK) != 0);
#else
SW1_Data_ADDR |= SW1_MASK;
// Ensure GPIO pullup active
return((SW1_Data_ADDR & SW1_MASK) == 0);
#endif
}
static BOOL checkBindButton(void) {
WORD lvDelay;
if (bindButtonIsOn()) {
CYFISNP_TimeSet(&lvDelay, DEBOUNCE_TIME);
// Debounce delay 20ms
while (CYFISNP_TimeExpired(&lvDelay) == 0); // WAIT
if (bindButtonIsOn()) {
// If button still ON
while (bindButtonIsOn());
// Wait for button release
return(TRUE);
}
}
return(FALSE);
}
// ------------------------------------------------------------------------// checkJogButton()
// ------------------------------------------------------------------------#define DEBOUNCE_TIME
(25/CYFISNP_TIMER_UNITS)
// about 25 mS
static BOOL jogButtonIsOn(void) {
#if SWITCHES_ACTIVE_HIGH
SW2_Data_ADDR &= ~SW2_MASK;
// Ensure GPIO pulldown active
return((SW2_Data_ADDR & SW2_MASK) != 0);
#else
SW2_Data_ADDR |= SW2_MASK;
// Ensure GPIO pullup active
return((SW2_Data_ADDR & SW2_MASK) == 0);
#endif
}
static BOOL checkJogButton(void) {
WORD lvDelay;
if (jogButtonIsOn()) {
CYFISNP_TimeSet(&lvDelay, DEBOUNCE_TIME);
// Debounce, delay 20ms
while (CYFISNP_TimeExpired(&lvDelay) == 0); // WAIT
if (jogButtonIsOn()) {
// If button still ON
while (jogButtonIsOn());
// Wait for button release
return(TRUE);
Document Number: 001-48033 Rev. *F
Page 19 of 36
CyFi™ Star Network Protocol Stack Datasheet
}
}
return(FALSE);
}
// ------------------------------------------------------------------------// showSignon() - Just show some generally useful debug stuff
// ------------------------------------------------------------------------static void showSignon(void) {
CYFISNP_OutStr("\n\r\n-------------------------------------------\n\r");
CYFISNP_OutStr(__FILE__);
#if HI_TECH_C
CYFISNP_OutStr(" by HiTech");
#else
CYFISNP_OutStr(" by ImageCraft");
#endif
CYFISNP_OutStr(" on ");
CYFISNP_OutStr(__DATE__);
CYFISNP_OutStr(", ");
CYFISNP_OutStr(__TIME__);
// --------------------------------------------------------------------#if (!CYFISNP_EXTERNAL_PA)
CYFISNP_OutStr("\n\rExtPA=NO");
#else
CYFISNP_OutStr("\n\rExtPA=YES");
#endif
// ------------------------------------------------------------------------#if (CYFISNP_PWR_TYPE == CYFISNP_PWR_WALL)
CYFISNP_OutStr(", PwrSrc=WALL\n\r");
#else
CYFISNP_OutStr(", PwrSrc=BATTERY\n\r");
#endif
// ------------------------------------------------------------------------}
// #########################################################################
Document Number: 001-48033 Rev. *F
Page 20 of 36
CyFi™ Star Network Protocol Stack Datasheet
Operation Reference
This section gives detailed information about the operation of the CyFi Star Network Protocol Stack.
Hub Protocol Modes
The following is a state diagram of the hub.
Figure 2.
Hub State Diagram
Document Number: 001-48033 Rev. *F
Page 21 of 36
CyFi™ Star Network Protocol Stack Datasheet
Hub Ping Mode
Ping mode is used by the hub to find an available channel; channels are unavailable if they are being used
by another hub with the same SOP code, or if there is excessive noise on the channel. Upon arriving on a
new channel, the hub takes 32 RSSI samples and if any sample is greater than pingRssiThreshold, the
hub goes to the next channel in the subset. If one complete cycle through the channel subset occurs, then
pingRssiThreshold is incremented. If the RSSI samples show a quiet channel, then the hub sends a ping
request using the zero-CRC Seed. If an AutoAck is received, the hub goes to the next channel in the
subset. Otherwise, Data Mode is entered on the channel.
Figure 3.
Hub Ping Mode Detail
Figure 4.
Hub Ping Message Sequence Chart
Document Number: 001-48033 Rev. *F
Page 22 of 36
CyFi™ Star Network Protocol Stack Datasheet
Hub Data Mode
Data mode allows application data to be transmitted from a node to the hub. The hub continuously listens
for data packets from nodes. When valid data is received from a node, the hub returns an AutoACK to the
node and sends the data to the application. The hub monitors the interference level and moves to ping
mode if the RSSI interference threshold RSSI_NOISE_THRESHOLD is reached. This ensures that the
hub is operating on a quiet channel and is capable of receiving node packets.
Figure 5.
Hub Data Mode Detail
Document Number: 001-48033 Rev. *F
Page 23 of 36
CyFi™ Star Network Protocol Stack Datasheet
Hub Bind Mode
Hub bind mode is usually entered by a user event (button bind) and changes from the hub network
parameters to the bind network parameters. The hub listens for a bind request on each channel for
approximately 320 ms before selecting the next channel using the channel selection algorithm to mitigate
channel interference. Normally, the first bind request received by the hub results in storing the node
information in the hub's flash. A subsequently received bind request (when the hub has the bind
information stored in its flash) results in returning a bind response to the node and completing the bind
process.
Figure 6.
Hub Bind Detail
Unbind
An ‘unbind’ mechanism allows the hub to unbind (and possibly replace) a previously bound node. At the
hub, unbinding the node is done by zeroing the flash EEP_DEV_REC entry for the particular device ID.
Node Protocol Modes
Figure 7.
Node State Overview
Document Number: 001-48033 Rev. *F
Page 24 of 36
CyFi™ Star Network Protocol Stack Datasheet
Node Power On Reset
If the node has network parameters stored in its flash memory, then the node moves to connect mode. If
no network parameters are available, then the node waits in idle sleep mode until a user-initiated event
causes the node to enter bind mode.
Node Bind Mode (Button Bind)
The node assumes the bind network parameters and transmits hub bind requests. If an AutoACK is
received, the node enables its receiver and listens for an immediate hub bind response. If a hub bind
response is not received, the node moves to the next channel. If a hub bind response is received, the
node stores the hub bind information in flash and moves to connect mode. Upon delivering a bind
response, the hub automatically exits bind mode.
Figure 8.
Node Hub Search Mode Detail
Node Connect Mode
Connect mode is used by the node on power up to establish a connection with the hub. Connect mode is
used at power up or a serious communications disruption has occurred. Upon entering connect mode the
node uses the hub network parameters to select a channel using the channel selection algorithm. The
node transmits connect requests. If an AutoACK is received the node pauses and listens for a connect
response.
If a hub in data mode receives a connect request from one of its nodes, it sends a positive connect
Response to the node and resets its sequence bits for the node. If a node receives a positive connect
response it moves to data mode. If a node does not receive a positive connect response, it selects the
next channel using the channel selection algorithm and repeats the procedure. If the node does not
receive a positive connect response on any of the channels in the subset, it goes to sleep (remaining in
connect mode) pending user activity to conserve power.
Document Number: 001-48033 Rev. *F
Page 25 of 36
CyFi™ Star Network Protocol Stack Datasheet
Figure 9.
Node Connect Mode Detail
Node Data Mode
When the node application has data to send to the hub the node transmits a DATA packet and listens for
an AutoACK. If an AutoACK is not received, the node retransmits the packet. If the node does not receive
an AutoACK after n DATA_PACKETS_RETRIES of retransmissions of the data packet it assumes the hub
has changed channels and then enters node ping mode. If the nodes still fails to contact the hub, it
assumes the channel has become unavailable due to excessive interference and goes to connect mode
timeout. The packet to be transmitted is held until the node ping or connect is successful and then
transmitted. Transmit data packets are never discard.
Figure 10. Node Data Mode Detail
Document Number: 001-48033 Rev. *F
Page 26 of 36
CyFi™ Star Network Protocol Stack Datasheet
Node Ping Mode
Node ping mode is entered when a node has a problem sending data to the hub. The hub may have
simply changed channels, there may be interference, or the hub may be out-of-range. Node ping mode
attempts to locate the hub to complete the data delivery.
Figure 11. Node Ping Mode State Detail
Miscellaneous Topics
Channel Subset and Sequence
The Base Channel defines one of the 6 mutually exclusive channel subsets. Each of the 13 channels in a
subset has 6 MHz spacing. The Sequence through the channel subset is defined by the channel hop
parameter. The channel hop parameter reduces the possibility of multiple hubs using the same channel
subset in the same order. The figure shows the 8 different sequences through base channel 5’s subset.
Figure 12. Possible Sequences though the Base Channel 5 Channel Subset
Document Number: 001-48033 Rev. *F
Page 27 of 36
CyFi™ Star Network Protocol Stack Datasheet
Node Report Rate
The nodes report to the hub on an “on demand” basis. A transmit could occur due to a wake timer or user
input (button press). A typical packet transaction with back channel data should take about 1.5 ms, giving
a raw channel capacity of 667 packets-per-sec (pps). Considering that the Aloha protocol results in an
ideal 82% reduction in channel capacity, this gives about 120 pps.
Back Channel Data
Back channel data provides a mechanism for the hub application to send data to the node at the request
of the node. The node is responsible for interrogating the hub for back channel data as part of a forward
data packet. The node starts by setting the BCDR bit in the data header. If the packet is successfully
acknowledged by the hub then the node enters receive mode with the node network parameters then
waits for n ms trying to receive from the hub. In the case of a wall powered hub, the hub can transmit a
back channel data packet immediately without waiting for a request from the node.
Bind Timing
When the bind button on the hub is pressed, the hub assumes bind network parameters (see the Bind
Mode section for more information on the bind network parameters). The hub enables its receiver and
‘listens’ for a Hub Bind Request packet from the node, starting from the first Bind Channel. The hub listens
for approximately 320 ms on the channel before moving to the next channel in the channel subset. A Bind
Response is returned to the node if the hub allows the node to bind.
When the bind button on the node is pressed, the node assumes the Bind Network Parameters and sends
a Hub Bind Request packet and listens for an AutoACK packet. If the node does not receive the AutoACK,
it moves to the next channel in the bind channel subset and repeats the Hub Bind Request. If an AutoACK
is received, the node remains on the channel for a few extra milliseconds expecting a hub bind response.
Because the hub's and node's bind buttons may be pressed at different times, the hub and the node could
be on very different channels when the two are in bind mode. However, because the node ‘hops’ very
quickly on all bind channels while the hub stays relatively long on a channel, the hub and node have
multiple opportunities of being on the same channel.
Dynamic Data Rate
Dynamic Data Rate (DDR) shifts between 250 kbps and 1 Mbps. The 250 kbps speed has a more robust
packet (with more tolerance to chip errors), while 1Mbps has shorter RF packets that collide less with
interference (for example, 802.11) and extend battery life. Each node implements DDR. The hub returns
an AutoAck and potential back channel data at the node’s selected rate (as indicated by its transmitted
packet).
Each node maintains a low-pass filtered statistics for 250 kbps and 1Mbps transmission success. Using
k=3, the following equation updates the statistics:
statistic = statistic – [(statistic + (1<<k) – 1) >>k] + ({0 or 1}<<k)
The statistic has min = 0 and max = 2*2k – (2k – 1) (if k=3, max=57). The figure shows the response to
different input sequences. The red line indicates the Good or Bad line and the blue line is the Max decision
line.
Document Number: 001-48033 Rev. *F
Page 28 of 36
CyFi™ Star Network Protocol Stack Datasheet
Figure 13. Dynamic Data Rate
Dynamic PA
Dynamic PA reduces power consumption (extends battery life) and is particularly important when using an
external power amplifier. Since the hub is wall powered, its PA is kept at the highest transmission power.
Note
Dynamic PA does not handle the “close proximity” condition where the receiver may be overpowered by a nearby transmitter.
Combining Dynamic PA and Dynamic Data Rate
In Ping, Connect, and Bind Modes, 8DR is always used and PA is set to +4 dBm. If an external PA is
provided, PA is subsequently incremented each cycle through channel set. In Data Mode, the following
table governs behavior:
GFSK Statistic
8DR Statistic
Behavior in Data Mode
Bad
Bad
Alternate between GFSK and 8DR.
PA setting = MAX and both statistics = MAX
Bad
Good
Favor 8DR over GFSK (4:1).
No change to PA setting.
Good
Bad
Favor GFSK over 8DR (4:1)
No change to PA setting.
Good
Good
Favor GFSK over 8DR (4:1)
If either statistic = MAX 16 consecutive times, then --PA setting.
Document Number: 001-48033 Rev. *F
Page 29 of 36
CyFi™ Star Network Protocol Stack Datasheet
Packet Structures
Overview
The first byte of each packet is the Header byte. Some packets may consist only of the header byte while
other packets may contain up to 14 payload bytes.
Figure 14. General Packet Type Byte
Byte
1
Bit
Value
7:5
000
000
000
001
001
Comment
Packet Type:
Node Bind Request Packet. Sent with Zero CRC Seed
Ping Packet. Sent with Zero CRC Seed
Connect Packet. Sent with Nonzero CRC Seed
Forward Channel Data Packet. Sent with Hub CRC Seed
Back Channel Data Packet. Sent with Node CRC Seed
The other 6 packet types are reserved for future use (for example, encryption).
1
4
1
3:0
0=REQ
1=RSP
The REQ/RSP bit was included so that a packet listener could distinguish the packet
types.
Used for packet specific information. The packet definitions below define how these
four bits are used in each case.
Protocol Packets
Binds can be differentiated from Connect packets based on the SOP Code used. REQ and RSPs can be
differentiated based on the originator. REQ come from nodes while RSP comes from hub.
Node Bind Request Packet
Figure 15. Node Bind Request Packet (7 Bytes)
Document Number: 001-48033 Rev. *F
Page 30 of 36
CyFi™ Star Network Protocol Stack Datasheet
Byte
Bit
1
Value
7:5
Comment
000
Packet Type:
Protocol Packet = 000
1
4
0 = REQ
Request.
1
3:2
00
Not used.
1
1:0
Attributes
2
-
Device ID
If the hub finds this node’s MID in the hub’s FLASH record for the
specified Device ID (or an Device ID), then a ConRsp(Accept) is
returned. Otherwise a ConRsp(Deny) is returned to reject this
node.
3-6
-
Node MID
Node MID The 4-byte Node MID is to uniquely identify the node
to the hub. The node MID is passed up to the application for
processing. The user would match the node MID in the GUI with
the MID printed on the node hardware. The node’s MID is also be
used by protocol to recognize a node that’s been seen before.
7
-
Reserved
Reserved
Hub Bind Response Packet
Figure 16. Hub Parameter Response Packet (10 Bytes)
Byte
1
Bit
Value
7:5
Comment
000
Packet Type:
Protocol Packet = 000
1
4
1 = RSP
Response.
1
3:0
0000
Not used.
2
-
Device ID
If the hub finds this node’s MID in the hub’s FLASH record for the specified
Device ID (or an Device ID), then a ConRsp(Accept) is returned. Otherwise a
ConRsp(Deny) is returned to reject this node.
3-6
-
Node MID
Node MID The 4-byte Node MID is to uniquely identify the node to the hub.
The node MID is passed up to the application for processing. The user would
match the node MID in the GUI with the MID printed on the node hardware.
The node’s MID is also be used by protocol to recognize a node that’s been
seen before.
Document Number: 001-48033 Rev. *F
Page 31 of 36
CyFi™ Star Network Protocol Stack Datasheet
Byte
Bit
Value
Comment
7-8
15:0
Hub CRC Seed
CRC Seed used by the Hub when it is receiving.
9
7:0
Base Channel
The starting channel in the channel sequence.
10
7:5
SOP Index
SOP Code (defined earlier).
10
2:0
Ch Hop
Channel Hop (defined earlier).
Node Connect Request
A CONNECT_REQ is made when the node is restarted. The hub and node reset their data sequence bits
during a CONNECT_REQ.
Figure 17. Node Connect Request (6 Bytes)
Byte
1
Bit
Value
7:5
Comment
000
Packet Type:
Protocol Packet = 000
1
4
0 = REQ
Request.
1
3:2
00
Not used.
1
1:0
00
01
10
= 0 for current-limited battery (coin-cell) node.
= 1 for wall-powered (idle in receive) node.
= 2 for high current battery (alkaline cell) node.
2
-
Device ID
Device ID
3-6
-
Node MID
Node MID The 4-byte Node MID is to uniquely identify the node to the hub.
Hub Connect Response Packet
Connect Response packets are sent from the hub to the node in response to valid Connect Requests.
Figure 18. Hub Connect Response (6 Bytes)
Document Number: 001-48033 Rev. *F
Page 32 of 36
CyFi™ Star Network Protocol Stack Datasheet
Byte
1
Bit
Value
7:5
Comment
000
Packet Type:
Protocol Packet = 000
1
4
1 = RSP
Response.
1
3:0
0000
Not used.
2
-
Device ID
Device ID assigned by the hub. If the Device ID is zero the hub
has rejected the Bind Request.
3-6
-
Node MID
The MID retrieved from the node's connection request. This
allows two nodes that bind at the same time to determine who
the Bind Response packet is for.
If a node requests back channel data but it has been replaced by a new node, the hub transmits a
Connection Response packet with a Device ID of 0. This indicates this node has been replaced by new
node and the node should unbind itself and go to sleep.
Hub Ping Packet
The Hub Ping Packet (sent using the Zero CRC Seed) is used by a Hub when searching for a new
channel to determine whether a foreign Hub using the same SOP Code is currently on the candidate
channel. If so (that is, a Ping Response is received), then the hub’s channel search continues.
Figure 19. Hub Ping Request Packet (1 Byte)
Byte
1
Bit
Value
7:5
Comment
000
Packet Type:
Protocol Packet = 000
1
4
0
1
Request.
Response.
1
3:0
0000
Not used.
Node Ping Packet
The Node Ping Packet (sent using the Hub CRC Seed) is used when searching for the hub’s current
channel within the network channel subset. The hub AutoAcks the node’s Ping (silently discarding it) and
the node returns to Data Mode. Unlike Connect Mode, no authentication and no information other than the
AutoAck is returned.
Document Number: 001-48033 Rev. *F
Page 33 of 36
CyFi™ Star Network Protocol Stack Datasheet
At the discretion of the node, the node’s Data packet may be retransmitted instead of a Node Ping packet.
(In this case, the hub would handle the Data packet and would be unaware of the node’s channel
searching activity).
Figure 20. Node Ping Packet (2 Bytes)
Node Data Packet
Data packets are sent from the node to the hub in connected mode.
Figure 21. Node Data Packet (0 to 16 Bytes)
Byte
1
Bit
Value
7:5
Comment
001
Packet Type:
Data Packet = 0x1
1
4
0
Destination. 0 = Hub.
1
3
0
Not used.
1
2
0
1
Back Channel Data Request:
No back channel data is requested.
The node listens for back channel data following the transaction.
1
1
0
1
1
0
0
1
Synchronous Bit:
Data is not synchronous.
Indicates underlying data is periodic (or synchronous). New and
retransmitted packets are not distinguished, so duplicate packets could
result and packet delivery is not guaranteed. Note that when the
synchronous bit is one the transmit sequence bit is not used and should be
zero.
Tx Sequence Bit:
New packet.
Retransmitted packet.
2
-
Device ID Device ID of the node transmitting the data packet assigned by the hub.
3-16
-
Data
Document Number: 001-48033 Rev. *F
Application data (0 to 14 bytes).
Page 34 of 36
CyFi™ Star Network Protocol Stack Datasheet
Hub Back Channel Data Packet
Figure 22. Hub Back Channel Data Packet (0 to 15 Bytes)
Byte
1
Bit
Value
7:5
Comment
001
Packet Type:
Data Packet = 0x1
1
4
1
Destination. 1 = Node.
1
3:2
0
Not used.
1
1
0
1
1
2-15
0
-
Synchronous Bit:
Data is not synchronous.
Indicates underlying data is periodic (or synchronous). New and retransmitted packets
are not distinguished, so duplicate packets could result and packet delivery is not
guaranteed. Note that when the synchronous bit is one the transmit sequence bit is not
used and should be zero.
0
1
Transmit (Tx) Sequence Bit:
New packet.
Retransmitted packet.
Data
Application data (0 to 14 bytes).
Document Number: 001-48033 Rev. *F
Page 35 of 36
CyFi™ Star Network Protocol Stack Datasheet
Version History
Version Originator
Description
1.0
DHA
Modified IRQ Input description.
1.0.b
DHA
Added wizard help file.
2.00
DHA
1. Updated the MUM GUI to restore support for CY8C20xx6 devices.
2. Added warning message in the MUM GUI when there is not enough memory to build a
HUB.
3. Added support for CY8C28x45 devices.
4. Updated the value lists of the "Power Supply Type" parameter.
5. Removed the redundant "Node Power Supply Type" parameter.
6. Updated the OnCYFISNPHubPlace() function to support the CY3271 FirstTouch kit.
2.00.b
DHA
Added CYRF89x35 device support.
2.00.c
MYKZ
Added CY8C24093 support.
Note
PSoC Designer 5.1 introduces a Version History in all user module datasheets. This section documents high level descriptions of the differences between the current and previous user module versions.
Document Number: 001-48033 Rev. *F
Revised May 24, 2013
Page 36 of 36
Copyright © 2009-2013 Cypress Semiconductor Corporation. The information contained herein is subject to change without notice. Cypress Semiconductor Corporation assumes no responsibility
for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any license under patent or other rights. Cypress products are not warranted nor intended
to be used for medical, life support, life saving, critical control or safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its
products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress products
in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges.
PSoC Designer™ and Programmable System-on-Chip™ are trademarks and PSoC® is a registered trademark of Cypress Semiconductor Corp. All other trademarks or registered trademarks
referenced herein are property of the respective corporations.
Any Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide patent protection (United States and foreign),
United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works
of, and compile the Cypress Source Code and derivative works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with
a Cypress integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source Code except as specified above is
prohibited without the express written permission of Cypress.
Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes without further notice to the materials described herein. Cypress does not
assume any liability arising out of the application or use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems
where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress' product in a life-support systems application implies that the manufacturer
assumes all risk of such use and in doing so indemnifies Cypress against all charges.
Use may be limited by and subject to the applicable Cypress software license agreement.