Coyote (BL2500)
User's Manual
PREV INDEX NEXT


Appendix D. RabbitNet

D.1 General RabbitNet Description

RabbitNet is a high-speed synchronous protocol developed by Rabbit to connect peripheral cards to a master and to allow them to communicate with each other.

D.1.1 RabbitNet Connections

All RabbitNet connections are made point to point. A RabbitNet master port can only be connected directly to a peripheral card, and the number of peripheral cards is limited by the number of available RabbitNet ports on the master.


Figure D-1. Connecting Peripheral Cards to a Master

Use a straight-through Ethernet cable to connect the master to slave peripheral cards, unless you are using a device such as the OP7200 that could be used either as a master or a slave. In this case you would use a crossover cable to connect an OP7200 that is being used as a slave.

Distances between a master unit and peripheral cards can be up to 10 m or 33 ft.

D.1.2 RabbitNet Peripheral Cards

Visit our Web site for up-to-date information about additional cards and features as they become available.

D.2 Physical Implementation

There are four signaling functions associated with a RabbitNet connection. From the master's point of view, the transmit function carries information and commands to the peripheral card. The receive function is used to read back information sent to the master by the peripheral card. A clock is used to synchronize data going between the two devices at high speed. The master is the source of this clock. A slave select (SS) function originates at the master, and when detected by a peripheral card causes it to become selected and respond to commands received from the master.

The signals themselves are differential RS-422, which are series-terminated at the source. With this type of termination, the maximum frequency is limited by the round-trip delay time of the cable. Although a peripheral card could theoretically be up to 45 m (150 ft) from the master for a data rate of 1 MHz, Rabbit recommends a practical limit of 10 m (33 ft).

Connections between peripheral cards and masters are done using standard 8-conductor Ethernet cables. Masters and peripheral cards are equipped with RJ-45 8-pin female connectors. The cables may be swapped end for end without affecting functionality.

D.2.1 Control and Routing

Control starts at the master when the master asserts the slave select signal (SS). Then it simultaneously sends a serial command and clock. The first byte of a command contains the address of the peripheral card if more than one peripheral card is connected.

A peripheral card assumes it is selected as soon as it receives the select signal. For direct master-to-peripheral-card connections, this is as soon as the master asserts the select signal. The connection is established once the select signal reaches the addressed slave. At this point communication between the master and the selected peripheral card is established, and data can flow in both directions simultaneously. The connection is maintained so long as the master asserts the select signal.

D.3 Function Calls

The function calls described in this section are used with all RabbitNet peripheral cards, and are available in the RNET.LIB library in the Dynamic C RABBITNET folder.

int rn_init(char portflag, char servicetype);


Resets, initializes, or disables a specified RabbitNet port on the master single-board computer. During initialization, the network is enumerated and relevant tables are filled in. If the port is already initialized, calling this function forces a re-enumeration of all devices on that port.
Call this function first before using other RabbitNet functions.
Parameters
portflag is a bit that represents a RabbitNet port on the master single-board computer (from 0 to the maximum number of ports). A set bit requires a service. If portflag = 0x03, both RabbitNet ports 0 and 1 will need to be serviced.
servicetype enables or disables each RabbitNet port as set by the port flags.
0 = disable port
1 = enable port
Return Value
0

int rn_device(char pna);


Returns an address index to device information from a given physical node address. This function will check device information to determine that the peripheral card is connected to a master.
Parameter
pna is the physical node address, indicated as a byte.
7,6--2-bit binary representation of the port number on the master
5,4,3--Level 1 router downstream port
2,1,0--Level 2 router downstream port
Return Value
Pointer to device information. -1 indicates that the peripheral card either cannot be identified or is not connected to the master.
See Also

int rn_find(rn_search *srch);


Locates the first active device that matches the search criteria.
Parameter
srch is the search criteria structure rn_search:
Use a maximum of 3 macros for the search criteria:
For example:
Return Value
Returns the handle of the first device matching the criteria. 0 indicates no such devices were found.
See Also

int rn_echo(int handle, char sendecho, char *recdata);


The peripheral card sends back the character the master sent. This function will check device information to determine that the peripheral card is connected to a master.
Parameters
handle is an address index to device information. Use rn_device() or rn_find() to establish the handle.
sendecho is the character to echo back.
recdata is a pointer to the return address of the character from the device.
Return Value
The status byte from the previous command. -1 means that device information indicates the peripheral card is not connected to the master.

int rn_write(int handle, int regno, char *data, int datalen);


Writes a string to the specified device and register. Waits for results. This function will check device information to determine that the peripheral card is connected to a master.
Parameters
handle is an address index to device information. Use rn_device() or rn_find() to establish the handle.
regno is the command register number as designated by each device.
data is a pointer to the address of the string to write to the device.
datalen is the number of bytes to write (0-15).

NOTE A data length of 0 will transmit the one-byte command register number.

Return Value
The status byte from the previous command. -1 means that device information indicates the peripheral card is not connected to the master, and -2 means that the data length was greater than 15.
See Also

int rn_read(int handle, int regno, char *recdata, int datalen);


Reads a string from the specified device and register. Waits for results. This function will check device information to determine that the peripheral card is connected to a master.
Parameters
handle is an address index to device information. Use rn_device() or rn_find() to establish the handle.
regno is the command register number as designated by each device.
recdata is a pointer to the address of the string to read from the device.
datalen is the number of bytes to read (0-15).

NOTE A data length of 0 will transmit the one-byte command register number.

Return Value
The status byte from the previous command. -1 means that device information indicates the peripheral card is not connected to the master, and -2 means that the data length was greater than 15.
See Also

int rn_reset(int handle, int resettype);


Sends a reset sequence to the specified peripheral card. The reset takes approximately 25 ms before the peripheral card will once again execute the application. Allow 1.5 seconds after the reset has completed before accessing the peripheral card. This function will check peripheral card information to determine that the peripheral card is connected to a master.
Parameters
handle is an address index to device information. Use rn_device() or rn_find() to establish the handle.
resettype describes the type of reset.
0 = hard reset--equivalent to power-up. All logic is reset.
1 = soft reset--only the microprocessor logic is reset.
Return Value
The status byte from the previous command. -1 means that device information indicates the peripheral card is not connected to the master.

int rn_sw_wdt(int handle, float timeout);


Sets software watchdog timeout period. Call this function prior to enabling the software watchdog timer. This function will check device information to determine that the peripheral card is connected to a master.
Parameters
handle is an address index to device information. Use rn_device() or rn_find() to establish the handle.
timeout is a timeout period from 0.025 to 6.375 seconds in increments of 0.025 seconds. Entering a zero value will disable the software watchdog timer.
Return Value
The status byte from the previous command. -1 means that device information indicates the peripheral card is not connected to the master.

int rn_enable_wdt(int handle, int wdttype);


Enables the hardware and/or software watchdog timers on a peripheral card. The software on the peripheral card will keep the hardware watchdog timer updated, but will hard reset if the time expires. The hardware watchdog cannot be disabled except by a hard reset on the peripheral card. The software watchdog timer must be updated by software on the master. The peripheral card will soft reset if the timeout set by rn_sw_wdt() expires. This function will check device information to determine that the peripheral card is connected to a master.
Parameters
handle is an address index to device information. Use rn_device() or rn_find() to establish the handle.
wdttype
0 enables both hardware and software watchdog timers
1 enables hardware watchdog timer
2 enables software watchdog timer
Return Value
The status byte from the previous command. -1 means that device information indicates the peripheral card is not connected to the master.
See Also

int rn_hitwd(int handle, char *count);


Hits software watchdog. Set the timeout period and enable the software watchdog prior to using this function. This function will check device information to determine that the peripheral card is connected to a master.
Parameters
handle is an address index to device information. Use rn_device() or rn_find() to establish the handle.
count is a pointer to return the present count of the software watchdog timer. The equivalent time left in seconds can be determined from count × 0.025 seconds.
Return Value
The status byte from the previous command. -1 means that device information indicates the peripheral card is not connected to the master.
See Also

int rn_rst_status(int handle, char *retdata);


Reads the status of which reset occurred and whether any watchdogs are enabled.
Parameters
handle is an address index to device information. Use rn_device() or rn_find() to establish the handle.
retdata is a pointer to the return address of the communication byte. A set bit indicates which error occurred. This register is cleared when read.
7--HW reset has occurred
6--SW reset has occurred
5--HW watchdog enabled
4--SW watchdog enabled
3,2,1,0--Reserved
Return Value
The status byte from the previous command.

int rn_comm_status(int handle, char *retdata);


Parameters

handle is an address index to device information. Use rn_device() or rn_find() to establish the handle.
retdata is a pointer to the return address of the communication byte. A set bit indicates which error occurred. This register is cleared when read.
7--Data available and waiting to be processed MOSI (master out, slave in)
6--Write collision MISO (master in, slave out)
5--Overrun MOSI (master out, slave in)
4--Mode fault, device detected hardware fault
3--Data compare error detected by device
2,1,0--Reserved
Return Value
The status byte from the previous command.

D.3.1 Status Byte

Unless otherwise specified, functions returning a status byte will have the following format for each designated bit.

7 6 5 4 3 2 1 0

×

×

00 = Reserved

01 = Ready

10 = Busy

11 = Device not connected

×

0 = Device

1 = Router

×

0 = No error

1 = Communication error1

×

Reserved for individual peripheral cards

×

Reserved for individual peripheral cards

×

0 = Last command accepted

1 = Last command unexecuted

×

0 = Not expired

1 = HW or SW watchdog timer expired2

1 Use the function rn_comm_status() to determine which error occurred.

2 Use the function rn_rst_status() to determine which timer expired.



Rabbit—A Digi International Brand
www.rabbit.com
PREV INDEX NEXT