![]() |
| Coyote (BL2500) User's Manual |
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.
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
- Digital I/O
- 24 inputs, 16 push/pull outputs, 4 channels of 10-bit A/D conversion with ranges of 0 to 10 V, 0 to 1 V, and -0.25 to +0.25 V. The following connectors are used:
- A/D converter
- 8 channels of programmable-gain 12-bit A/D conversion, configurable as current measurement and differential-input pairs. 2.5 V reference voltage is available on the connector. The following connectors are used:
- D/A converter
- Display/Keypad interface
- allows you to connect your own keypad with up to 64 keys and one character liquid crystal display from 1 × 8 to 4 × 40 characters with or without backlight using standard 1 × 16 or 2 × 8 connectors. The following connectors are used:
- Relay card
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.LIBlibrary in the Dynamic CRABBITNETfolder.
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.
Parameters
- Call this function first before using other RabbitNet functions.
portflagis 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. Ifportflag= 0x03, both RabbitNet ports 0 and 1 will need to be serviced.
servicetypeenables or disables each RabbitNet port as set by the port flags.Return Value
- 0 = disable port
- 1 = enable port
- 0
Parameter
- 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.
pnais the physical node address, indicated as a byte.Return Value
- 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
See Also
- Pointer to device information. -1 indicates that the peripheral card either cannot be identified or is not connected to the master.
rn_findParameter
- Locates the first active device that matches the search criteria.
srchis the search criteria structurern_search:
unsigned int flags; // status flags see MATCH macros below
unsigned int ports; // port bitmask
char productid; // product id
char productrev; // product rev
char coderev; // code rev
long serialnum; // serial number
- Use a maximum of 3 macros for the search criteria:
RN_MATCH_PORT // match port bitmask
RN_MATCH_PNA // match physical node address
RN_MATCH_HANDLE // match instance (reg 3)
RN_MATCH_PRDID // match id/version (reg 1)
RN_MATCH_PRDREV // match product revision
RN_MATCH_CODEREV // match code revision
RN_MATCH_SN // match serial number
- For example:
rn_search newdev;Return Value
newdev.flags = RN_MATCH_PORT|RN_MATCH_SN;
newdev.ports = 0x03; //search ports 0 and 1
newdev.serialnum = E3446C01L;
handle = rn_find(&newdev);See Also
- Returns the handle of the first device matching the criteria. 0 indicates no such devices were found.
rn_device
int rn_echo(int handle, char sendecho, char *recdata);
Parameters
- 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.
handleis an address index to device information. Usern_device()orrn_find()to establish the handle.
sendechois the character to echo back.Return Value
recdatais a pointer to the return address of the character from the device.
- 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);
Parameters
- 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.
handleis an address index to device information. Usern_device()orrn_find()to establish the handle.
regnois the command register number as designated by each device.
datais a pointer to the address of the string to write to the device.
datalenis the number of bytes to write (0-15).Return Value
NOTE A data length of 0 will transmit the one-byte command register number. See Also
- 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.
rn_read
int rn_read(int handle, int regno, char *recdata, int datalen);
Parameters
- 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.
handleis an address index to device information. Usern_device()orrn_find()to establish the handle.
regnois the command register number as designated by each device.
recdatais a pointer to the address of the string to read from the device.
datalenis the number of bytes to read (0-15).Return Value
NOTE A data length of 0 will transmit the one-byte command register number. See Also
- 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.
rn_write
int rn_reset(int handle, int resettype);
Parameters
- 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.
handleis an address index to device information. Usern_device()orrn_find()to establish the handle.
resettypedescribes the type of reset.Return Value
- 0 = hard reset--equivalent to power-up. All logic is reset.
- 1 = soft reset--only the microprocessor logic is reset.
- 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);
Parameters
- 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.
handleis an address index to device information. Usern_device()orrn_find()to establish the handle.Return Value
timeoutis 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.
- 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);
Parameters
- 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.
handleis an address index to device information. Usern_device()orrn_find()to establish the handle.
wdttypeReturn Value
- 0 enables both hardware and software watchdog timers
- 1 enables hardware watchdog timer
- 2 enables software watchdog timer
See Also
- The status byte from the previous command. -1 means that device information indicates the peripheral card is not connected to the master.
rn_hitwd, rn_sw_wdt
int rn_hitwd(int handle, char *count);
Parameters
- 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.
handleis an address index to device information. Usern_device()orrn_find()to establish the handle.Return Value
countis a pointer to return the present count of the software watchdog timer. The equivalent time left in seconds can be determined fromcount× 0.025 seconds.See Also
- The status byte from the previous command. -1 means that device information indicates the peripheral card is not connected to the master.
rn_enable_wdt, rn_sw_wdt
int rn_rst_status(int handle, char *retdata);
Parameters
- Reads the status of which reset occurred and whether any watchdogs are enabled.
handleis an address index to device information. Usern_device()orrn_find()to establish the handle.
retdatais a pointer to the return address of the communication byte. A set bit indicates which error occurred. This register is cleared when read.Return Value
- 7--HW reset has occurred
- 6--SW reset has occurred
- 5--HW watchdog enabled
- 4--SW watchdog enabled
- 3,2,1,0--Reserved
- The status byte from the previous command.
int rn_comm_status(int handle, char *retdata);
Parameters
handleis an address index to device information. Usern_device()orrn_find()to establish the handle.
retdatais a pointer to the return address of the communication byte. A set bit indicates which error occurred. This register is cleared when read.Return Value
- 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
- 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 1 = Communication error1
1 = HW or SW watchdog timer expired2
1 Use the function rn_comm_status()to determine which error occurred.
2 Use the functionrn_rst_status()to determine which timer expired.
| RabbitA Digi International Brand www.rabbit.com |