Hardware Information: Dual SJA1000 CAN card


External HD-15 connector pinout

Pin # Channel Assignment
012CAN-LOW
021CAN-LOW
031RX0
041TX0
052RX0
062CAN-HIGH
071CAN-HIGH
081RX1
091TX1
10BothV- in
112TX0 / TRIG-IN-ARMED
122TX1 / TRIG-OUT
132RX1 / TRIG-IN
15BothV+ in

BUS termination requirements

If termination is needed place a 120 Ohm resistor between CAN High and CAN Low.

Event definitions


The following values may be transmitted as FT_EVENT type GCProtocol frames.
The event value will be in the event field of such a frame.
Note: Please see the include files dev_527.h or dev_sja.h for numeric values of the following symbols.

Event nameEvent meaning
EVENT_MSG_SENT   An FT_DATA frame with a timestamp value of EVENT_ON_SEND or EVENT_ON_SEND_PROXY has been transmitted. See CMD_SERVER_SET_TIMED_XMIT for more information
 
GCANBUSOFFBus OFF state reached
GCANBUSWARNBus WARNING state reached
GCANBUSOKBus OK (return from Bus WARNING state)
GCANERRFRAMEError Frame / Stuff Error detected (1 data byte for position; see table 1)
GCANARBLOSTArbitration lost (1 data byte for position; see table 1)
GCANRXOVERReceiver overflow detected
GCANFORMForm error detected (1 data byte for position; see table 1)
GCANACKAcknowledgment error (none received during attempted transmit or receive)
GSJABITBit error (1 data byte for position; see table 1)
GSJAOTHEROther error (1 data byte for position; see table 1)
GSJATRIGSETInput trigger made transition and the current value is 1. (See documentation for Ioctl GSJAGETTRIGCTRL below for more information.)
GSJATRIGRESETInput trigger made transition and the current value is 0. (See documentation for Ioctl GSJAGETTRIGCTRL below for more information.)

 

The following table decodes the single data byte that accompanies the GCANERRFRAME, GCANFORM, GSJABIT and GSJAOTHER event. Two events, one GSJAOTHER and the other GCANFORM are interpreted by the driver and will never be reported as expected. Both GSJAOTHER events with a data byte of 25 (19 hexadecimal) and GCANFORM events with a data byte of 59 (3B hexadecimal) are reported as GCANACK events. (With no data byte.)

The data byte is shown in binary format. Bit 5 of the values, indicated by x, specifies whether the error occurred while transmitting or receiving the message. A value of 1 indicates the error occurred during reception. A value of 0 indicates that the error occurred during transmission.

TABLE 1  Data byte     Error location
00x0 0011start of frame
00x0 0010ID.28 to ID.21
00x0 0110ID.20 to ID.18
00x0 0100bit SRTR
00x0 0101bit IDE
00x0 0111ID.17 to ID.13
00x0 1111ID.12 to ID.5
00x0 1110ID.4 to ID.0
00x0 1100bit RTR
00x0 1101reserved bit 1
00x0 1001reserved bit 0
00x0 1011data length code
00x0 1010data field
00x0 1000CRC sequence
00x1 1000CRC delimiter
00x1 1001acknowledge slot
00x1 1011acknowledge delimiter
00x1 1010end of frame
00x1 0010intermission
00x1 0001active error flag
00x1 0110passive error flag
00x1 0011tolerate dominant bits
00x1 0111error delimiter
00x1 1100overload flag

 

The following table decodes the single data byte that accompanies the GCANARBLOST event.

TABLE 2  Data byte     Description
0arbitration lost in bit 1 of identifier
1arbitration lost in bit 2 of identifier
2arbitration lost in bit 3 of identifier
3arbitration lost in bit 4 of identifier
4arbitration lost in bit 5 of identifier
5arbitration lost in bit 6 of identifier
6arbitration lost in bit 7 of identifier
7arbitration lost in bit 8 of identifier
8arbitration lost in bit 9 of identifier
9arbitration lost in bit 10 of identifier
10arbitration lost in bit 11 of identifier
11arbitration lost in bit SRTR (Bit RTR for standard frame messages)
12arbitration lost in bit IDE
13arbitration lost in bit 12 of identifier (Extended frame messages only)
14arbitration lost in bit 13 of identifier (Extended frame messages only)
15arbitration lost in bit 14 of identifier (Extended frame messages only)
16arbitration lost in bit 15 of identifier (Extended frame messages only)
17arbitration lost in bit 16 of identifier (Extended frame messages only)
18arbitration lost in bit 17 of identifier (Extended frame messages only)
19arbitration lost in bit 18 of identifier (Extended frame messages only)
20arbitration lost in bit 19 of identifier (Extended frame messages only)
21arbitration lost in bit 20 of identifier (Extended frame messages only)
22arbitration lost in bit 21 of identifier (Extended frame messages only)
23arbitration lost in bit 22 of identifier (Extended frame messages only)
24arbitration lost in bit 23 of identifier (Extended frame messages only)
25arbitration lost in bit 24 of identifier (Extended frame messages only)
26arbitration lost in bit 25 of identifier (Extended frame messages only)
27arbitration lost in bit 26 of identifier (Extended frame messages only)
28arbitration lost in bit 27 of identifier (Extended frame messages only)
29arbitration lost in bit 28 of identifier (Extended frame messages only)
30arbitration lost in bit 29 of identifier (Extended frame messages only)
31arbitration lost in bit RTR of identifier (Extended frame messages only)

Please also see generic events for non card-specific events.


Card-specific IOCTL definitions


These values are used with the CMD_CARD_IOCTL command.
Please see the include files dev_527.h and dev_sja.h for numeric values of IOCTLS and data field bit assignments.

IOCTL nameFunctionData field length/purpose
GCANGETBTRSGet SJA1000 BTR values2 data bytes returned: current BTR0 and BTR1 values
GCANSETBTRSSet SJA1000 BTR values2 data bytes: new BTR0 and BTR1 values
Set values valid only after next INIT ioctl.
GCANGETBCGet SJA1000 Output Control Register1 data byte: current output control register
GCANSETBCSet SJA1000 Output Control Register1 data byte: new output control register
Value valid only after next INIT ioctl.
GGETERRLEVGet driver error level reporting1 data byte: current mode
Modes include (values may be ORed):
0 - Report Bus Warn and Bus Off conditions
1 - Report all bus errors
2 - Report data overrun
4 - Report arbitration lost
GSETERRLEVSet driver error level reporting1 data byte: new mode (effective after next INIT ioctl). As above.
GCANGETMODEGet internal/external transceiver selection1 data byte: current transceiver selection (Version 1.1 and above)
GCANSETMODESet internal/external transceiver selection1 data byte: new transceiver selection (effective immediately) (Version 1.1 and above)
GCANGETTRANSGet internal/external transceiver selection1 data byte: current transceiver selection
0 - internal transceiver
1 - external transceiver
GCANSETTRANSSet internal/external transceiver selection1 data byte: new transceiver selection (effective immediately). As above.
GCANSENDERRSend an error frame. (The error level must have its least significant bit set for this to work.)None
GSJAGETINTTERMGet external/internal termination1 data byte: current termination
0 - external   (default at power on)
1 - internal termination
GSJASETINTTERMSet external/internal termination1 data byte: new termination selection (effective immediately). As above.
GSJAGETLISTENGet listen/normal mode1 data byte: current mode
0 - Normal
1 - Listen only
GSJASETLISTENSet listen/normal mode1 data byte: new mode
Mode changes only after next INIT ioctl. As above.
GSJAGETSELFTESTGet self test/normal mode1 data byte: current mode
0 - Normal
1 - Self test
GSJASETSELFTESTSet self test/normal mode1 data byte: new mode
Mode changes only after next INIT ioctl. As above.
GSJAGETXMITONCEGet transmit once/normal mode1 data byte: current mode
0 - Normal
1 - Transmit once
GSJASETXMITONCESet transmit once/normal mode1 data byte: new mode
Mode changes immediately. As above.
GSJAGETTRIGSTATEGet input trigger state1 data byte: current state
0 - Reset
1 - Set
GSJAGETTRIGCTRLGet input trigger control1 data byte: current mode
0 - Do not send event
1 - Send only 1 event
2 - Send event for each 0 to 1 and 1 to 0 transition
GSJASETTRIGCTRLSet input trigger control1 data byte: new mode
Mode changes immediately. As above.
GSJAGETOUTSTATEGet digital output state1 data byte: current state
0 - Reset
1 - Set
GSJASETOUTSTATESet digital output state1 data byte: new state
State changes immediately. As above.
GSJAGETFILTERGet the filter3 or 5 data bytes depending on the length of the filter
Byte 1: number of header bytes = 2
Bytes 2 and 3: the standard header to match, in network order, high byte first
- OR -
Byte 1: number of header bytes = 4
Bytes 2 thru 5: the extended header to match, in network order, high byte first
GSJASETFILTERSet the filter3 or 5 data bytes depending on the length of the filter
Filter changes immediately. As above.
GSJAGETMASKGet the filter mask3 or 5 data bytes depending on the length of the mask
Byte 1: number of mask bytes = 2
Bytes 2 and 3: mask for a standard header, in network order, high byte first
- OR -
Byte 1: number of mask bytes = 4
Bytes 2 thru 5: mask for an extended header, in network order, high byte first
GSJASETMASKSet the filter mask3 or 5 data bytes depending on the length of the mask
Mask changes immediately. As above.

Notes:

  • While in the listen mode no data may be transmitted and no Acks are appended to received messages. All data on the bus is received as normal. If a message is not Ack'ed by another node, it is not valid message and is not be available to be read. If the error level reporting is set to report bus errors, a GCANACK (Ack error) event will be reported for each unacknowledged message on the bus.
  • While in the self-test mode, the channel appends an Ack to each message it transmits on the CAN bus. This allows the channel to be the only device on a CAN network.
  • While in the transmit once mode, all message transmissions are attempted only once. If arbitration is lost, the message is not transmitted. If an Ack error occurs for a transmitted message and the transmit error count on the SJA1000 chip (available as register 15 (0x0F) via the generic GETREG ioctl) is greater than 127, an Ack is appended to the transmitted message. If the transmit error count is less than 128, an Ack is not appended.
  • The ability to pulse the trigger output based on an incoming message's header (CAN ID) is provided by a single filter and mask that can be set and read via the GSJASETFILTER, GSJAGETFILTER, GSJASETMASK and GSJAGETMASK ioctls described above. This filter does not affect data flow between the CAN bus and the server or any client. This filter is separate and distinct from the filtering that may be configured by a client using the CMD_CARD_ADD_FILTER command.
  • Setting the filter causes the mask to be set to 0x07FF or 0x1FFFFFFF which means that all bits of a conforming message must match the filter. If one or more bits should be ignored, set those bits in the mask to zero.
  • Only one filter and mask are available per card. In order to cause the output trigger to pulse, a conforming message must arrive on the channel used to specify the filter and mask. In other words, with a filter and mask set, a conforming message on one channel will cause the trigger output to pulse, but an identical message on the other channel will not pulse the trigger output.
  • Because the external transceiver connections for the second channel use the same pins as the input and output triggers, any ioctl command regarding the triggers, including the filter and mask will return an error if the second channel is set to use an external transceiver. Likewise, when the external transceiver is set for the second channel, any existing filter and mask are deleted.
  • Individual error frames may be generated by transmitting a message with the invalid 11-bit ID 0xff 0xff, or the invalid 29-bit ID 0xff 0xff 0xff 0xff. Error level reporting must have its least significant bit set to generate error frames.
  • Reception of a CAN frame with the RTR bit set causes the MODE_REMOTE bit to be set in the mode element of the Data Header of an FT_DATA frame sent to clients. Likewise setting the MODE_REMOTE bit in the mode element of the Data Header of an FT_DATA frame sent to the server causes it to send a CAN frame with the RTR bit set.