Campbell Scientific SDM-CAN User Manual

SDM-CAN
Datalogger-to-CANbus
Interface
Revision: 8/13
Copyright © 2001-2013
Campbell Scientific, Inc.

Warranty

Assistance

Products may not be returned without prior authorization. The following contact information is for US and international customers residing in countries served by Campbell Scientific, Inc. directly. Affiliate companies handle repairs for customers within their territories. Please visit
www.campbellsci.com to determine which Campbell Scientific company serves
your country.
To obtain a Returned Materials Authorization (RMA), contact CAMPBELL SCIENTIFIC, INC., phone (435) 227-9000. After an applications engineer determines the nature of the problem, an RMA number will be issued. Please write this number clearly on the outside of the shipping container. Campbell Scientific’s shipping address is:
CAMPBELL SCIENTIFIC, INC. RMA#_____ 815 West 1800 North Logan, Utah 84321-1784
For all returns, the customer must fill out a “Statement of Product Cleanliness and Decontamination” form and comply with the requirements specified in it. The form is available from our web site at www.campbellsci.com/repair. A completed form must be either emailed to repair@campbellsci.com or faxed to (435) 227-9106. Campbell Scientific is unable to process any returns until we receive this form. If the form is not received within three days of product receipt or is incomplete, the product will be returned to the customer at the customer’s expense. Campbell Scientific reserves the right to refuse service on products that were exposed to contaminants that may cause health or safety concerns for our employees.

Table of Contents

PDF viewers: These page numbers refer to the printed version of this document. Use the PDF reader bookmarks tab for links to specific sections.
1. Introduction.................................................................1
1.1 General Description .............................................................................1
1.2 Specifications .......................................................................................2
1.2.1 General Features and Specifications .............................................2
1.2.2 Electrical Specifications................................................................3
1.2.2.1 Power Consumption...........................................................3
1.2.3 Physical Specifications .................................................................4
2. Installation...................................................................4
2.1 Address Switch Configuration .............................................................4
2.2 Internal Jumper Settings.......................................................................5
2.3 Connection to the Datalogger and Power Supply.................................8
2.3.1 LED Status Indication.................................................................10
2.4 Connection to CAN-Bus. ...................................................................10
3. Programming CR10X, CR7 and CR23X
Dataloggers to use the SDM-CAN.........................12
3.1 General Principles ..............................................................................12
3.2 System Limitations.............................................................................13
3.3 The Datalogger Instruction.................................................................14
3.3.1 Instruction 118: SDM-CAN........................................................15
3.3.2 SDM Address (Parameter 01:)....................................................15
3.3.3 TQUANTA, TSEG1, TSEG2 (Parameters 02:, 03:, 04:)............15
3.3.4 ID (Parameters 05:, 06:, 07:).......................................................17
3.3.5 Data Type (Parameter 08:)..........................................................18
3.3.5.1 Collect and retrieve a data value: .....................................19
3.3.5.2 Build a data frame for transmission: ................................19
3.3.5.3 Transmit individual data values onto the CAN-Bus:........20
3.3.5.4 Transmit a previously built data frame on to the
CAN-Bus (type 25):......................................................20
3.3.5.5 Set-up previously built data frame as a Remote Frame
Response (type 26): ......................................................21
3.3.5.6 Read error counters (type 27):..........................................21
3.3.5.7 Read and reset the error counters (type 28):.....................21
3.3.5.8 Read status (type 29):.......................................................21
3.3.5.9 Read the signature and version number of the
SDM-CAN operating system (type 30): .......................22
3.3.5.10 Send Remote Frame Request (type 31):...........................22
3.3.5.11 Set SDM-CAN internal software switches (type 32): ......22
3.3.5.12 Read SDM-CAN internal switches (type 33):..................24
3.3.6 Start Bit Number (Parameter 09:) ...............................................24
3.3.7 Number of Bits (Parameter 10:)..................................................24
3.3.8 Number of Values (Parameter 11:) .............................................25
3.3.9 Location (Parameter 12:) ............................................................25
i
Table of Contents
3.3.10 Multiplier (Parameter 13:).......................................................... 25
3.3.11 Offset (Parameter 14:) ................................................................ 25
3.4 Advanced Programming Techniques................................................. 25
3.4.1 Interrupts Using the I/O Connection .......................................... 25
3.4.2 Group Trigger............................................................................. 27
3.4.3 Frame buffers with filtering and triggering ................................ 27
3.4.3.1 Setup of Mask and Filter / trigger.................................... 28
3.4.3.2 Reading / Polling Buffer.................................................. 28
3.4.3.3 Basic Sequence of Buffer Usage: .................................... 29
3.5 Program Examples............................................................................. 29
3.5.1 Reading CAN Data..................................................................... 29
3.5.2 Simple CAN Data Transmission ................................................ 30
3.5.3 Building and Sending Data Frames............................................ 32
3.5.4 Using the Interrupt Function ...................................................... 32
3.5.5 Using the Group Trigger ............................................................ 34
4. Programming CRBasic Dataloggers to use the
SDM-CAN.................................................................35
4.1 General Principles ............................................................................. 35
4.1.1 High Speed Block Mode ............................................................ 36
4.2 Datalogger Instruction ....................................................................... 36
4.2.1 Reading CAN Data..................................................................... 37
4.2.2 Simple CAN Data Transmission ................................................ 38
4.2.3 Digital I/O Triggered CANbus Measurements........................... 39
4.2.4 SlowSequence Instruction .......................................................... 40
5. Using the RS232 Serial Diagnostics Port ...............40
5.1 Connecting to the RS232 User Port................................................... 40
5.2 Diagnostic Commands....................................................................... 41
5.3 Loading a New Operating System into the SDM-CAN Interface ..... 43
6. Attributions................................................................44
Appendices
Principles of Operation...........................................A-1
A.
A.1 Data Collection................................................................................ A-1
A.2 Frame Transmission ........................................................................ A-2
B. A Summary of Data Types......................................B-1
C. Application of the SDM-CAN on Networks
Complying with the J1939 SAE Standards.........C-1
C.1 J1939 29-Bit Identifier Format ........................................................ C-1
C.2 J1939 11-Bit Identifier Format ........................................................ C-1
C.3 J1939 Data Frame Format ............................................................... C-2
ii
C.4 Retrieving J1939 Accelerator Pedal Position Data using a
CR9000/CR5000 (Bus Speed 250k Baud)....................................C-2
C.4.1 Encoding the Identifier Field Values ........................................C-2
C.4.2 Finding the Start Bit..................................................................C-3
C.5 Retrieving J1939 Accelerator Pedal Position Data using a
CR23X/CR10X (Bus Speed 250k Baud) ......................................C-4
C.5.1 Encoding the Identifier Field Values ........................................C-4
C.5.2 Finding the Start Bit..................................................................C-5
D. Examples of CAN Data Frames and Data
Encoding and Decoding ...................................... D-1
Figures
1-1. SDM-CAN CAN-Bus Interface ...........................................................1
2-1. SDM-CAN Internal Jumpers................................................................7
2-2. SDM-CAN Isolation enabled (default) ................................................7
2-3. SDM-CAN Isolation disabled..............................................................8
2-4. Using the Spring Loaded Terminal Blocks (Top Option)....................9
2-5. Using the Spring Loaded Terminal Blocks (Front Option)..................9
Table of Contents
Tables
2-1. Switch Position and Addresses ............................................................5
2-2. LED Status Indication........................................................................10
2-3. CIA CAN Connector Pin Connections...............................................11
3-1. Typical settings of the CAN Speed Parameters .................................17
5-1. RS232 Pin Out ...................................................................................40
C-1. Mapping of the J1939 Fields into a 29-Bit Identifier.......................C-1
C-2. Mapping of the J1939 Fields into a 11-Bit Identifier.......................C-1
C-3. J1939 Data Frame Format................................................................C-2
C-4. Mapping of J1939 Identifier Field values into a 29-Bit Identifier....C-3
C-5. Accelerator Pedal Position Value Byte Number ..............................C-3
C-6. Mapping of J1939 Identifier Field Values into a 29-Bit Identifier...C-4
C-7. Accelerator Pedal Position Value Byte Number ..............................C-5
iii
Table of Contents
iv
SDM-CAN Datalogger-to-CANbus Interface

1. Introduction

The SDM-CAN interface is designed to allow a Campbell Scientific datalogger to sample data directly from a CAN-Bus communications network and thereby allow such data to be stored along with, and in synchronization with, other data values measured directly by the datalogger.
To use the SDM-CAN device it is assumed that you have a full working understanding of the CAN network you wish to monitor. While there are moves to standardize CAN networks for different types of applications, the SDM-CAN device is designed to be as generic as possible thus allowing use in a wide range of applications, including research and development, where you may be working outside the normal standards.
As a result you will need to know details of the electrical configuration of the network, the speed and CAN standard in use, plus knowledge of the identifiers of the data packets that are of interest and the way in which data is encoded within those packets at the binary level. This information may need to be obtained from the designers of the network, from proprietary documentation or from the standards to which a network claims to comply.
Campbell Scientific cannot provide full technical support in the understanding and decoding of data on all types of CAN networks.
FIGURE 1-1. SDM-CAN CAN-Bus Interface

1.1 General Description

The SDM-CAN forms an intelligent interface between a Campbell Scientific datalogger and a CAN-Bus communications network. The SDM-CAN is configured by the datalogger under the control of the user’s datalogger program.
1
SDM-CAN Datalogger-to-CANbus Interface
By this process the SDM-CAN can capture data on the CAN-Bus and filter out packets of interest to the user. Within each data packet the device is able to read one or more data values and convert them to numeric values compatible with the normal data stored by the datalogger.
The SDM-CAN will act as a passive listen-only device with its transmitter disabled in hardware. Alternatively it can be configured to send/respond to Remote Frame Requests, allowing it to poll remote devices for data. Data packets can also be constructed to allow it to send data out onto the CAN-Bus so it then acts as a sensor itself.
Data is transferred between the SDM-CAN interface and the datalogger using Campbell Scientific’s high speed SDM communications protocol. This protocol allows the SDM-CAN to be used in parallel with other SDM devices (including other SDM-CAN interfaces) which might, for instance, be on other CAN-Bus networks in the same vehicle.
In addition to connectors to the CAN network and the datalogger, an RS232 port is also provided both for diagnostics and operating system upgrades.

1.2 Specifications

1.2.1 General Features and Specifications

Uses Campbell Scientific’s SDM communication protocol to communicate
with the datalogger via a three wire serial multidrop connection. Support is planned for CR10X, CR23X, CR7, CR5000 and CR9000 dataloggers.
Up to 16 units can be used per datalogger, with the modules’ SDM address
set by rotary switch.
CAN 2.0A and 2.0B active and passive modes supported
Up to 1Mbaud max data rate. Standard baud rates supported are 1M,
800K, 500K, 250K, 125K, 50K, 20K and lower. Other non-standard baud rates may be possible – please contact Campbell Scientific.
Receive and transmit up to 128 different data values from up to 128 CAN
ID’s.
Build and send a CAN data frame.
Send Remote Frame Requests.
Send data frame in response to an external Remote Frame Request.
Supports a number of power down modes to allow power saving in power
critical applications.
2
All configuration of the interface is specified within the user’s datalogger
program.
LED status flash at power up
Additional I/O port for signaling to the datalogger that data is available,
e.g. using an interrupt function.
Has a 9 pin, DCE RS232 port with auto baud rate detection (1200 to
115200) for diagnosis and operating software download.
Standard operating temperature range (tested), -25ºC to +50ºC. Can be
used over an extended temperature range – contact Campbell Scientific for details.
High speed block mode for fast data collection.
Buffer assisted burst mode for capturing back to back high speed CAN
data.
Buffer’s support data frame filtering and triggering.

1.2.2 Electrical Specifications

Power supply range: 7 to 26V DC.
Optional (switch selectable) galvanic isolation between the datalogger and
the CAN-Bus. The minimum isolation breakdown is 50V – this barrier is for signal isolation only, i.e. it is not a safety barrier.
SDM-CAN Datalogger-to-CANbus Interface
Hitachi H8S,16 bit CPU clocked at 10MHz.
Uses the latest Philips SJA1000 CAN controller clocked at 16MHz.
CAN-Bus physical interface using Philips PCA82C251 driver for 1Mbaud
capability, for use in 12V or 24V systems.
CAN-Bus physical connection conforms to CIA draft standard 102 version
2, 9 pin D connector. (The interface will differ from this standard only with respect to pin 9, which outputs 5V DC instead of 7-13V DC.)
A 3 way, unpluggable screw terminal block for CAN High, Low and G
also provided.
Transmit and acknowledge to CAN-Bus can be disabled by a hardware
jumper for safety reasons, e.g. for in-vehicle, listen only monitoring.
I/O terminal used for interrupts is pulled low by a 100Kohm resistor and is
driven to 5V via a 1Kohm impedance when an interrupt is pending.
1.2.2.1 Power Consumption
Typical active current in self-powered, isolated mode with the CAN-Bus
in the recessive state: 70mA. (This is when the SDM-CAN is not transmitting.)
Typical active current in self-powered, isolated mode with the CAN-Bus
in the dominant state: 120mA (this is when data is being transmitted from the SDM-CAN device).
3
SDM-CAN Datalogger-to-CANbus Interface
Where the DC-DC converter is not used, and power is provided to the
isolated CAN driver circuits by an external source, the current drain by the SDM-CAN is approximately 50 mA lower than the figures quoted above.
Typical active current, non-isolated with the CAN-Bus in the recessive
state: 30mA.
Typical active current, non-isolated with the CAN-Bus in the dominant
state: 70mA
Typical Standby Current with or without isolation is less than 1mA (in this
mode the CAN hardware is turned off so the module cannot wake on receipt of CAN data). Current consumption increases to typically 50 mA during periods of communication to the datalogger or when the RS232 port is active.

1.2.3 Physical Specifications

Maximum dimensions: width 175mm, height 100mm, depth 23mm
(without mounting brackets).
Weight: 300g without mounting brackets.

2. Installation

2.1 Address Switch Configuration

The device can be vertically mounted with all the connectors on the top
surface.
The SDM address switch is on the right hand side.
Fittings are available to allow vertical mounting in the CR9000 or on
enclosure chassis plates.
The SDM-CAN can be mounted in a normal card slot of a CR9000 (using optional special end brackets), on a chassis plate (using the standard brackets supplied) or can be left free-standing.
CR9000 and CR7 dataloggers require optional SDM connection kits and all dataloggers may require an upgrade to a version of operating system which supports the SDM-CAN interface.
Before installing the SDM-CAN, set the SDM address switch to ensure that the interface has a unique address on the SDM bus, and that the address is set to match the commands in the datalogger program relevant to each interface.
4
The SDM address switch can be set to 1 of 16 addresses. The factory-set address is 00. TABLE 2-1 shows switch position and the corresponding address. The Base 4 address is also shown, as this is the address entered in the datalogger program.
SDM-CAN Datalogger-to-CANbus Interface
Please see Section 3, Programming CR10X, CR7 and CR23X Dataloggers to use the SDM-CAN, before using address F (33 base 4) as this address is often
used as a ‘group trigger’ to synchronize measurements by several SDM devices.
The switch is positioned on the right-hand side of the case, so you may have to remove the mounting bracket to gain access to this switch.
TABLE 2-1. Switch Position and Addresses
Switch Setting Base 4 Address
0 00
1 01
2 02
3 03
4 10
5 11
6 12
7 13
8 20
9 21
A 22
B 23
C 30
D 31
E 32
F 33

2.2 Internal Jumper Settings

The SDM-CAN interface is fitted with a number of jumpers which configure the connection to the CAN network.
Prior to setting these jumpers you need to give some consideration on how best to connect the SDM-CAN interface to the network:
1) Decide whether the CAN network is already terminated, or if the SDM-
CAN needs to provide termination. In most instances the network will already be terminated and so the default setting is no termination.
2) Decide whether to operate the SDM-CAN in a mode where it is isolated
from the CAN network. This is the ‘safest’ mode of operation as it minimizes the risk of corrupting the CAN data by the formation of grounds loops which could inject noise onto the CAN-Bus. The default setting is to run in isolated mode.
5
SDM-CAN Datalogger-to-CANbus Interface
3) If running in isolated mode decide whether the SDM-CAN will supply
power via a built-in DC-DC converter for the isolated CAN interface components, or whether power will be sourced from an external supply. Using a converter adds 40-50mA to the power consumption of the SDM­CAN when it is active. However, if a converter is not used, power must be provided from elsewhere (see below). The default setting is for the converter to be OFF, although for many applications you may need to turn it on once you have considered the implications for your power supply.
4) Decide whether the transmit functions of the SDM-CAN interface need to
be enabled in hardware. The disabled mode of operation is the safest, especially in vehicle applications, as it avoids the risk of the SDM-CAN sending bad data onto the CAN network. However, in some modes of operation, transmission is obligatory e.g. to let the SDM-CAN request data, acknowledge data or to transmit data onto the bus. If transmission is to be enabled, the relevant jumpers need to be changed. Additionally transmission must be enabled by sending the SDM-CAN an instruction which both enables and specifies the method of transmission. See Section
3.3, The Datalogger Instruction, data type 32, below.
Access to the jumpers requires the removal of the lid of the SDM-CAN. Please follow anti-static precautions during the removal of the lid and also when changing the jumpers. Refer to FIGURE 2-1 for details of the jumper positions. Labels are also provided in white writing on the circuit board.
If white jumper block not fitted then refer to FIGURE 2-2 for isolation enabled and FIGURE 2-3 for isolation disabled.
6
SDM-CAN PCB
Once the case lid has been removed.
OBSERVE ANTI­STATIC PRECAUTIONS.
This jumper block is used to select isolated or non­isolated CAN-Bus interface. The jumper block can be removed and rotated so that the red bar is nearest to the mode arrow head. The default is for isolation enabled.
SDM-CAN Datalogger-to-CANbus Interface
The DC-DC converter is off by default. This will reduce power consumption from the +12V supply but means that the isolated circuits must be powered externally. To enable the DC-DC converter move the jumper to the DC-DC ON position.
Transmission of CAN data is hardware
disabled
by default. To enable transmission, move the jumper to the TX enable position.
The CAN-Bus termination impedance is disabled by default. If you need the bus to be terminated, then move the jumper to the 120R IN position.
FIGURE 2-1. SDM-CAN Internal Jumpers
FIGURE 2-2. SDM-CAN Isolation enabled (default)
7
SDM-CAN Datalogger-to-CANbus Interface
FIGURE 2-3. SDM-CAN Isolation disabled

2.3 Connection to the Datalogger and Power Supply

To allow communication between the SDM-CAN and a datalogger, firstly connect it to the datalogger’s SDM port, and then connect to a 12V power supply. Both the datalogger and the SDM-CAN 12V power supply must share a common ground.
The SDM port is provided in different ways on different dataloggers:
CR10X and CR23X – use the C1, C2 and C3 control ports.
CR7 – a special SDM terminal block is provided as part of the SDM upgrade
kit. This terminal block is fitted on a small module adjacent to the 9 way ‘Serial I/O’ connector on the front of the 700 control module. The connections are labeled C1, C2 and C3.
CR5000 – use the port connections labeled SDM-C1, SDM-C2 and SDM-C3.
CR9000 – connections are made via the 9 way, ‘CSI Serial I/O’ connector on
the 9080 PAM card. Pins 6, 7 and 8 are used as C3, C2 and C1 respectively. Pin 2 is ground. Campbell Scientific offers connection modules for this port which allow access to the SDM function as well as retaining normal function of the serial port, please contact your local sales office for further details.
The SDM-CAN requires a nominal 12V power supply connection (7-26V) rated at 150mA. Normally the datalogger supply can be used for this feed. A connection to ground is also required. If the 12V supply is separate from the datalogger, both the ground of the supply and datalogger must be connected together.
8
The SDM and power connections are made to a black terminal block on the left-hand side of the SDM-CAN interface. This terminal block has special spring loaded terminals which are simple to use and highly resistant to loosening in high vibration environments. To open the terminal simply insert
SDM-CAN Datalogger-to-CANbus Interface
the tip of a small flat blade screw driver (3mm width) into the rectangular hole above the circular terminal hole. Push in the blade of the screwdriver until the spring is released and the terminal opens. Insert the pre-stripped wire and then remove the screwdriver. See FIGURE 2-4. If space is limited, as when the unit is mounted in an enclosure etc., the screwdriver can be inserted into the front of the terminal block to push open the spring, as shown in FIGURE 2-5.
FIGURE 2-4. Using the Spring Loaded Terminal Blocks (Top Option)
FIGURE 2-5. Using the Spring Loaded Terminal Blocks (Front Option)
Where you need to install more than one wire in a single terminal connector, use only stranded wires and twist the wires together before inserting them in the terminal. This type of terminal is not suitable for use with multiple solid core wires unless the wires are joined externally, e.g. using a ferrule.
Route the wires from the SDM-CAN interface to the datalogger connections using the shortest route. Avoid running them near cables which could cause noise pickup. In noisy environments use low capacitance signal cable with an overall foil screen, connecting the screen to the datalogger power ground.
Where multiple SDM devices are in use connect them in parallel to datalogger SDM ports, making sure each device has a unique SDM address. Ensure that the maximum cable length between the datalogger and the SDM-CAN does not exceed 3 meters.
9
SDM-CAN Datalogger-to-CANbus Interface
An additional I/O terminal is provided on the SDM-CAN for use with dataloggers which support interrupt driven logging events. This might typically be used to enable the rapid capture of time critical CAN data, where the I/O port can be used to indicate to the datalogger that data has been captured and is available for immediate collection (see below). In most applications this function will not be used and the terminal need not be connected. Where it is required, it should be connected to a digital input on the datalogger.

2.3.1 LED Status Indication

When power is applied to the SDM-CAN the red ‘STATUS’ LED will flash to indicate the current status of the unit as a result of the power-up checks.
If the LED flashes once, the module has passed all power-up tests and should operate correctly. The other flash sequences are shown below. Problems with the operating system can normally be fixed by reloading the operating system.
Please contact Campbell Scientific if you are unable to resolve the problem.
TABLE 2-2. LED Status Indication
Number of flashes Indication
1 SDM-CAN is ok.
2 OS signature bad.
10 OS downloaded has failed.

2.4 Connection to CAN-Bus.

The physical connection to the CAN-Bus is achieved by one of two methods which is by either the 3 way un-pluggable screw terminals or the 9 pin ‘D’ plug which conforms to CIA draft standard 102 version 2.
The basic connections of the CAN-Bus to the three-way terminal are CAN High, CAN Low and 0V ground reference. The 3 way screw terminal is marked as ‘G H L’ on the SDM-CAN case, where G=Ground, H=CAN High, L=CAN Low.
The CIA, 9 pin, ‘D’ connector pin configuration is shown in TABLE 2-3.
10
SDM-CAN Datalogger-to-CANbus Interface
TABLE 2-3. CIA CAN Connector Pin Connections
Pin Function
1 Reserved, NOT INTERNALLY CONNECTED.
2 CAN Low.
3 CAN Ground.
4 Reserved, NOT INTERNALLY CONNECTED.
5 CAN Shield.
6 CAN Ground.
7 CAN High.
8 Reserved, NOT INTERNALLY CONNECTED.
9 CAN +5volts. Input or output (see text).
If the SDM-CAN hardware is configured (in either isolated or non-isolated mode) with the DC-DC converter ON, then Pin 9 of the 9 pin ‘D’ connector will provide +5V +/-10% at up to 40mA to any external device. If isolation is enabled and the DC-DC converter is set to OFF then this pin acts as an input for an external power supply capable of providing +5volts +/-10% at up to 100mA to provide power to the isolated circuitry of the SDM-CAN.
NOTE
The 3-way terminal block and CIA connector are connected in parallel internally and are not two separate connections to different CAN interfaces.
Please refer to the documentation for your CAN network to check the preferred method of connection. For many applications various standards will apply giving recommended practices for connection. Apart from the choice of connector some standards recommend different ways of ‘tapping’ into CAN networks and also recommend maximum lengths for ‘T’s or ‘stubs’ off the network. For instance, at the highest baud rate of 1Mbit/s, ISO11898 recommends a maximum bus length of 40 m and a maximum stub length of 0.3 m. These lengths increase significantly at lower bit rates.
As discussed above you also need to consider:
If the SDM-CAN should terminate the network
If it should be configured in isolated mode
If transmission should be enabled
The source of power for the isolation hardware.
11
SDM-CAN Datalogger-to-CANbus Interface

3. Programming CR10X, CR7 and CR23X Dataloggers to use the SDM-CAN

This section describes the programming methods used for the above dataloggers to configure and use the SDM-CAN Interface. This section also covers general principles and techniques which are relevant to the other dataloggers.

3.1 General Principles

The SDM-CAN interface is controlled by instructions that the user enters in the datalogger program. For the dataloggers covered by this section the Program Instruction is number P118. Full details of the instruction are given below. This sub-section has been written to introduce the parameters of Instruction P118 and how they allow you to control the different operations of the SDM-CAN.
The initial function is to configure the SDM-CAN interface when the datalogger program is compiled. At this stage, the datalogger analyses the P118 parameters used by the program and sends the relevant commands to the SDM­CAN to configure it to perform appropriate tasks.
The most common configuration task, at compile time, is to set up the SDM­CAN to instruct it to filter out only the data frames of interest from all data ‘passing on the bus’.
The other configuration task done at this point is to specify the speed at which the CAN-Bus is to operate. It is important to ensure the parameters which define the speed are set correctly and all instructions have the same values entered for these parameters otherwise either no data will be received, or you risk corrupting data on the bus, if the SDM-CAN is enabled for transmission.
The next common function is to read data back from the SDM-CAN, to decode it, and to store it in input locations once the program is running. A single entry of P118 in the program can both configure the SDM-CAN during program compilation and also cause data to be read back from the SDM-CAN when that instruction is executed during normal program execution.
Similarly there is also a function which is used to send simple data from the datalogger input locations onto the CAN-Bus via the SDM-CAN. Again a single call of P118 can both configure and then transmit the data when the program is running.
A more complicated version of this function is also possible where multiple P118 instructions are used to build a transmit data frame within the SDM­CAN, made up of a series of fixed or variable data values from input locations. A subsequent P118 is used to instruct the SDM-CAN to transmit the frame either immediately or in a response to a remote frame request from another device.
12
Finally there are some special functions normally achieved by a single a call of P118. One such function is used to change internal ‘switches’ within the SDM­CAN which control its mode of operation, e.g. power mode, response to failed transmissions etc. Similar functions also allow you to read back the settings of these ‘switches’ into input locations and also to read and/or reset the number of
CAN errors detected and to also determine the general status of the SDM-CAN interface.

3.2 System Limitations

The SDM-CAN interface, in combination with a datalogger, has some limitations of which you need to be aware:
1) Memory Allocation and P118
Firstly, as discussed above, when the datalogger compiles a program with P118 in it, it sends commands to the SDM-CAN instructing it what to do at run time. When it does this the SDM-CAN allocates some of its memory (a ‘bin’) for each call of P118 in the program. Appendix A, Principles of Operation, discusses the operation of these bins and other buffers in the SDM-CAN in more detail. However, most users only need to know that there is a limit of 128 bins in the SDM-CAN thus constraining the number of instances of P118 for any one SDM-CAN to
128.
It is, of course, possible to have several SDM-CAN devices connected to the datalogger(s), each with separate SDM addresses, and each with up to 128 calls of P118.
SDM-CAN Datalogger-to-CANbus Interface
2) Data Capture Limitations
Another limitation is the capability of the overall speed at which the datalogger can pick up and transfer data values back to its memory. These limitations do not arise within the SDM-CAN interface itself, as it uses a high speed CAN interface along with a fast microprocessor. Data can therefore be captured off the CAN-Bus at close to the maximum bus loading at the maximum baud rate. However, the limitations arise from the datalogger itself, both in terms of its capability to call P118 often enough (especially when making other measurements) and also in its capability to transfer the data from the SDM-CAN back into its memory over the SDM communications port.
The exact throughput possible is determined by a very complicated combination of variables, including the speed of the datalogger in question, the program it is running, how many SDM devices are in use and, to a lesser degree, other tasks it is running, e.g. communications activity.
In practice, for fast data, it will not be practical to capture every single data packet. However, the SDM-CAN will be used to sample the last reading it received on the CAN-Bus before the datalogger requests data.
If a new data value has not been captured from the CAN-Bus since the last value was transferred to the datalogger, the SDM-CAN can either be set to always return the previous value captured (default) or it can be configured (see the internal software switch settings below) to return the standard out of range value to the datalogger, i.e. –99999 if the value has already been read. This value will also be returned in the event of other errors including communication errors between the datalogger and SDM-CAN.
13
SDM-CAN Datalogger-to-CANbus Interface
Data stored in packets on the CAN-Bus can be encoded in a number of different ways. The SDM-CAN itself can cater for many different types of data, but there are some limitations imposed by the way in which the data is stored in the datalogger. The prime limitation is that data read into the datalogger is first converted into a 4 byte floating point format which can only resolve, at most, 23 bits, or roughly 7 digits, of the decimal equivalent of any number stored. Furthermore, when data is stored to final storage, the resolution is truncated again to either 4 or 5 digits (with the exception of the CR5000/9000 dataloggers which also support storage in IEEE4 format).
To avoid over-running the datalogger’s internal floating point resolution, the maximum length of integer that the SDM-CAN can send or receive is therefore limited to 16 bits. This limited resolution can cause problems when reading CAN data where data is encoded as 32 or 64 bit integers.
The simplest solution, in those cases, is to read the value as a series of 16 bit integers written to separate input locations in the datalogger. These can then either be combined once the data has been recovered to a computer or, if some of the resolution is not needed, the data values can be combined in the datalogger using its normal maths functions. You must bear in mind, however, the limitations of the 4-byte floating point calculations and the output resolution of the datalogger.
The CAN standard also allows some types of data to be spread across several data packets, where those data packets all have the same identifier. Such data normally would consist of fixed identifiers stored as ASCII data, which do not normally have to be logged. Reliably capturing such data with the SDM-CAN is not possible, with the current software, unless the sequential packets are transmitted relatively slowly. Please contact Campbell Scientific for further information if you have a requirement to do this.
14
3) When transmitting CAN frames from the SDM-CAN there are situations
where some frames are not transmitted. This is because the SDM-CAN has a two layer buffer for transmitted frames. This allows a frame to be transmitted whilst a new frame is being built. However if your program tries to send frames too quickly, before earlier frames are sent, the frames will be overwritten and lost.
This scenario generally does not happen with CR10X / CR23X loggers as they are not fast enough. But with the CR5000 / CR9000 loggers it is possible to overrun the double buffer especially in pipe line mode if you are transmitting more than 2 frames per scan. It is recommended to use sequential mode in this case as it allows a delay between CAN-BUS instructions.

3.3 The Datalogger Instruction

The instruction used by all of the dataloggers covered in this chapter is Instruction 118. The structure of the instruction and parameter types is shown below. This structure is given in the same format that normal instructions are shown in the datalogger manuals. Please refer to the datalogger manual for a
SDM-CAN Datalogger-to-CANbus Interface
description of the data types, entry of the instruction and how to index (‘--’) parameters.
NOTE
In some previous versions of datalogger operating systems, Instruction 118 was used for the now obsolete OBDII interface. Older datalogger manuals and Edlog help systems may still refer to this instruction. Please make sure you are using a version of the operating system that supports P118 and refer to a more recent datalogger manual or Edlog help system.
It will be apparent for some functions of P118 that some parameters are not relevant or have no function. In these cases simply leave the parameter(s) at their default value(s) which is normally zero.

3.3.1 Instruction 118: SDM-CAN

PARAM. NUMBER DATA TYPE DESCRIPTION RANGE
01: 2 SDM address 00..33
02: 2 TQUANTA 0-63
03: 2 TSEG1 0-15
04: 2 TSEG2 0-7
05: 4 ID bits 0-10 0-2047 ‘--’ Set 11bit ID.
06: 4 ID bits 11-23 0-8191
07: 2 ID bits 24-28 0-31
08: 2 Data type 0-33
09: 2 Start bit number 0-64, ‘--’ Left-hand referenced LSB.
10: 2 Number of bits 0-64, ‘--' Enable Interrupt mode.
11: 4 Number of values 0-99
12: 4 Input Location
13: FP Multiplier
14 FP Offset

3.3.2 SDM Address (Parameter 01:)

This parameter should match the SDM address set by the address switch on the side of the module to which this instruction applies. Please see Section 2.1, Address Switch Configuration, above, for more details. Also see the section below, regarding the special function of address 33.

3.3.3 TQUANTA, TSEG1, TSEG2 (Parameters 02:, 03:, 04:)

These parameters are used to set the bit rate and other timing parameters for the CAN-Bus network. On some networks the relationship between some of these parameters is predefined and just one parameter, the baud rate, is quoted. For maximum flexibility, though, the user is given access to all of the relevant parameters. TABLE 3-1 gives some typical values of the parameters for a
15
Loading...
+ 53 hidden pages