Design Studio: - CAN Bus Protocol - User Guide
Design Studio: - CAN Bus Protocol - User Guide
2
www.lascarelectronics.com
PanelPilotACE | CAN bus Protocol | User Guide | Issue 2 10/2019
Design Studio | CAN bus Protocol | User Guide
Contents
Page No.
1. Introduction 4
8. Address Limitations 13
Protocol
PanelPilotACE devices with CAN bus Standard J1939 defines a device
added is implemented through the connected and operated via CAN
Data can be regularly reported by The PanelPilotACE J1939 CAN bus 1. Make sure the SGD 70-A is
an ECU or by a Request PGN from Element also provides the ability to powered-off.
another ECU. reconfigure it’s address according to 2. Plug the S70-CAN Adapter into
a “Commanding Address” message. the SK2 Pin Header on the
Commanding ECUs can also send However, note that it is not able to reverse of the SGD 70-A device
queries to other ECUs to check the issue this message. (see Figure 1).
support feature. Users can create
PGNs by using the PanelPilotACE Each PGN contains 8 bytes. A PGN The CAN bus adapter can be wired
CAN Frame Builder in Design Studio. with a data length of more than 8 point to point or by multi-drop
This will automatically setup the bytes will be carried by a transport wiring.
response of the Request PGN and protocol message as defined by
acknowledge available features. J1939-21. Both Broadcast and An example of wiring an S70-CAN
RTS/CTS transport protocols are to a DB9-F connector can be seen in
Each ECU has its own 8 bit address supported. Figure 3.
and a 64 bit ECU Name. Public,
preferred addresses for ECUs can be Figure 2 shows a multi-drop
found in the J1939 Appendix that is wiring to system with multiple ECUs
available to view at www.sae.org. 2. Getting Started or SGD-70-A.
GND
CANL
CANH
S70-CAN
Terminal Block
CANL
CANH
5
Twisted Pair Signal Wires
S70-CAN
Terminal Block
3. Design Studio
Elements for
CAN bus
The PanelPilotACE Design Studio
contains two Elements and one
Project Variable for a user to enable
the CAN bus Protocol.
Element Channel S70-CAN includes a signal CAN bus port. This is always Channel 1
Properties The Frame Rate can be set as 125, 256, 512 or 1 Mbits. All devices
using CAN bus use the same frame rate.
The configurable properties of the Frame Rate Note: Do not connect a PanelPilotACE device to an active CAN bus
CAN bus Device Element can be with an unknown frame rate. Mismatched frame rates may cause
found in the Properties Editor within network nodes to switch to passive or bus-off mode.
the Design Studio. The Properties This allows selection of the version of the CAN bus Protocol to be
Editor is located in the top right- CAN Network used.
hand side of the Design Studio Type Note: Only CAN J1939 Protocol is functional at this time. Open CAN
workspace (see Figure 4). Table 1 and Native mode are reserved for future expansion.
describes which of the values and Every ECU controller connected to a CAN bus will process all data
fields within the Properties Editior frames on the bus and de-assert the ACK bit if any controller is
that can be configured. found with errors on a data frame. The original controller will
resend data frames until the accumulated error count exceeds the
Listen Only threshold that activates “Passive” or “Bus-off’ mode.
Mode
A user can configure the controller to operate in “Listen Only
Mode”.
It does not de-assert the ACK bit if an ECU is just used as a monitor
or to display an SPN parameter (i.e. read only).
Each ECU on a network will have at least one 64 bit Name and one
address assigned to it. A complex ECU can have multiple addresses
and names.
The Device Address, PGN and Message Priority form the CAN ID.
This affects the message priority. Addresses can be allocated
statically or dynamically using the “Address Claim” arbitration
process. An address with a higher priority is dependant on the
64bit Name (small values on the device address have higher
priority).
Table 1.
Variable P
E
D D
P P PF PS SA
-----
Data Field
3 1 1 8 8 8 0 - 64
The J1939 data frame structure
called a Protocol Data Unit (PDU) is
Key: P = Priority, EDP = Extended Data Page, DP = Data Page, PF = PDU Format, PS = PDU
displayed in Figure 6.
Specific, SA = Source Address.
PF = 0xFE, Since PF > 240, the spn1239 - Fuel Leakage - 1 - status signal indicates fuel leakage in the fuel rail of
second byte is GE not SA and the the engine. The location can be either before or after the fuel pump.
value is 0x07. 00 - no leakage detected
01 - leakage detected
Source Address (SA) = 0x10.
Bit Length 2 bits
Therefore, the PGN = 0xFE07= Type Status
65031. Suspect Parameter Number 1239
Parameter Group Number [65169]
According to specification, PGN spn1240 - Fuel Leakage - 2 - status signal indicates fuel leakage in the fuel rail of
65031 have 2 SPNs, SPN 2433 and the engine. The location can be either before or after the fuel pump.
SPN 2434. 00 - no leakage detected
01 - leakage detected
SPN 2433 is Right Manifold Exhaust Bit Length 2 bits
Gas Temperature a 16 bit, resolution Type Status
0.03125, offset -273°C. SPN 2434 Suspect Parameter Number 1240
which is the left side temperature. Parameter Group Number [65169]
If a CAN Frame Builder links to this CAN variable it can send a CAN
Source Address Frame to another device.
If this address is not matched in CAN bus Device Element then the PGN
will be processed as an incoming PGN and used to Decode CAN frame.
If a CAN Frame Builder links to this CAN variable it can capture CAN
frames from another device with source address matched.
If the length is larger than 8 bytes then the PanelPilotACE device will
Total Length automatically process the data using a Transport Message.
Click the “Add” button to activate a blank SPN, or click the SPN row to
SPN List edit it. Figure 8 shows the dialogue box to add and edit SPNs.
Note: Input order of the SPN in the list must match the J1939 spec.
Table 2.
Table 3.
If the Resolution Number has Note: Users can also set the scale as
several decimal places, you can 1 and use a Maths Builder or a Logic
check the “Reverse” check box. This Builder to process the parameter Figure 8. SPN Editor Dialogue Box
uses an inverse value to keep the externally.
6. CAN Frame
Builder
The CAN Frame Builder creates the
connection between a CAN Variable and
other PanelPilotACE project resources such
as Project Variables, Element Properties
or Actions (see Figure 9). A description of
the available properties for this Element is
listed in the Table 4 below:
Which CAN bus Variable is being used. CAN Frame Builder will use
CAN bus Variable the CAN bus Variable PGN and SPN information to Encode/Decode
the CAN Frame.
If the PGN is set as “Outgoing”, the record count sets the exact
record write. When the record count is set to more than 1, more
properties will appear in the Property Editor as seen in Figure 10.
Set “Enable Count Field” to true if the PGN has a first SPN to store
Enable Count Field
the record count.
A PanelPilotACE device does not have array or record type variables,
therefore PanelPilotACE will not process all records. Set the “Enable
Enable FIFO Access FIFO Access” to choose either process start from first or last records. Figure 9. CAN Frame Builder Properties
Enable FIFO is also a Runtime Property; a user can Enable/Disable
FIFO access using set rule action.
Note: If the record count is 2 and the PGN has 4 SPN as a record, it will
reserve 8 CAN Data fields and a total of 8 resources to link.
Some ECU (e.g. Engine, Throttle Position) will keep exchanging data
with a very high repetition rate (e.g. 20-50ms ). If you process all
the data and perform screen updates, the screen may overload the
PanelPilotACE CPU. Update Frequency controls how many repeated
Update Frequency PGN captures will trigger the Post Action.
7.2 Comms Error Handler Figure 12. Values for the Communications Error Handler.
The Communication Error Handler
can be configured to manage CAN
bus errors. All CAN Frame Elements can link to Property Name Description
a Communication Error Handler. If a Name connectionResolve
Figure 12 shows an example of this
CAN Frame Element cannot connect Select the CAN bus
set-up in the Property Editor. The
to the Communication Error Handler Port Connection Port/Device to be
properties have been configured as used.
then an Error Dialogue message will
shown in the Table 5. Two Resolve options
appear to notify the user. need to be set:
Property Name Description i) Reset Connection
- Resets the CAN bus
Name errorHandler 7.3 Resolve Connection Action port hardware.
Select CAN bus The Resolve Connection Action
Port/Device to Resolve Type ii) Reallocate Address -
Communication Port
be used (e.g.
controls different communication
Retries the Address
CANBusPort1) ports to resolve connection failures Claim procedure and
CAN bus including CAN bus. Figure 13 shows tries to claim the
Communication Type
Communication an example configuration set-up in device address if the
Add the link for Address Claim has
the Property Editor. The properties
Error Handlers individual Error to failed before.
Action. have been configured as shown in
Table 6. Table 6.
Table 5.
Num Direction Time Name ID(H) AD Src(H) AD Dest(H) Type Format Length Data(H)
0 Receive 18959.6842 RQST 18EA0CFE FE 0C Extend Data Frm 3 00 EE 00
TRACE ID DLC DATA 0 DATA 1 DATA 2 DATA 3 DATA 4 DATA 5 DATA 6 DATA 7 TIME STAMP (sec) TIME DELTA (sec)
RX 0x18EEFF0Cx 8 0x0A 0x00 0xC0 0x00 0x25 0x03 0x04 0x81 1637.2693 1.998
It also automatically replies for CAN Frame Builder: DA 50 CAN Frame Builder: DA 50
“Request PGN”. A user can broadcast
(DA=255) Request or Send Request CAN Frame
to other PanelPilotACE devices PGN: 0, DA: 50, SA: 12
with a Destination Address by using
Request PGN (RQST, PGN 59904). CAN bus
Figure 32 shows the Request PGN
process. To activate, take the
following steps: Figure 26. Capture the CAN Frame using SGD 70-A.
canCVariable1 Value
PGN 59904
Priority 6
Source Address 50
Data Length 3bytes
2540, Position 1.1,
SPN Length 24, Offset 0,
Scale 1, Range 0-65535.
Table 9.
Note: SPN Values are only labels used Figure 29. Creating new Integers and a Figure 30. Parameters/Data
in the Design Studio. They do not new float Variable.
affect the CAN frame Encode/Decode.
Request PGN does not have an SPN.
The data field only stores PGNs.
Inputting 0 or 2540 as the SPN value
will have the same result.
CAN bus
When sending a request with a PGN
of a Group Function, that ECU will
reply directly with data or reply an
acknowledge to tell you whether it Figure 32. The Request PGN process.
supports that feature or not.
2nd SGD-70A
Device Address: 50
CAN Variable: SA 12, PGN 0
Table 10.
to the number variable in the CAN Frame with String Data Type PGN 61445
In J1939 some PGNs have SPNs Priority 6
Frame builder. The reply is ACK if
with String Data Types. PGN 61445 Source Address 12
the value is 0.
Total Length 8
is an example of one of these. If
using this type, then the CAN Frame Table 11.
Builder set the SPN scale to 0 in the
CAN Variable as shown in Figure 36. Note: String Data Types do not need
Offset or Range. Input 0 in the SPN
Open the existing tutorial project Editor dialogue box.
and edit the CAN variable as shown
in Table 11.
Figure 38. Use CAN Bus Analyser to send the PGN 61445 to PanelPilotACE.
10. Tutorial: SPN Position Length (bits) Offset Scale Range Linked Project Variable
991
1.1
5.1
32
32
0
0
0.125
0.125
0/526385151.9
0/526385151.9
Number Variable (float)
canVariable65212 Value 4. Add a button image. Give the “TPCM” message is BAM, with
PGN 65212 button the action function “On PGN 65212, a total of 3 packets
Priority 7 Checked Perform” to the CAN and data length as 16 (see
Source Address 12 frame. Figure 41.)
Total Length 16
5. Upload the project to a SGD 7. 3 TPDP frames follow the
Table 12.
70-A device and set an analyser BAM carrier the data as seen in
3. Create a CAN Frame Builder to begin capturing data. Figure 40.
with CAN bus variable set to
6. If the button on the SGD 70-A
“canVariable65212” and the
is pressed the analyser will
Parameters/Data properties to
capture 4 frames. The first
12000, 26000.5, 4000100.1,
frame’s detail shows that the
60000.
200ms
Post Action TPDT (3) Post Action Post Action
TPDT (3)
Time Out Error
TPDT (3)
3 frames)
A (A CK 16by tes,
TPCM.EOM
RTS/CTS Transport
m
Address Cl ai 928
Reques t for 55 ,S A :12, Data: 60
Power ON
59 90 4 (DA :2
PGN :
ACL (SA:1
2, N am e
010 4 032
50 0 C0 0 0
05
0, DA:12
PGN 0, SA:7 Press Button
13. Tutorial:
Error Handling
The Design Studio provides a
“Communication Error Element” to
handle communication errors.
7. Go to the properties for the Figure 55. Reconfigurable Address Claim Process.
CAN Frame Builder. Choose the
created Error Handler in the
“Error Handler” property.
UK & Europe
www.lascarelectronics.com
[email protected]
+44(0)1794 884567
Americas
www.lascarelectronics.com
[email protected]
(814) 835 621
Asia
www.lascarelectronics.com
[email protected]
+852 2389 6502
Disclaimer:
Every effort has been made to ensure the accuracy of this publication and no
responsibility or liability can be accepted by Lascar Elecyronics Limited for any
errors or omissions in the content of this document. Data and legislation may PanelPilotACE
change, and so we strongly advise you to aquire and review the most recently CAN bus Protocol User Guide
issued regulations, standards, and guidelines. This publication does not form Issue 2 10/2019
the basis of a contract. © 2019 Lascar Electronics Limited