First Steps With CiX-CAN FreeCAN
First Steps With CiX-CAN FreeCAN
FreeCAN
Foreword
This document is a startup document that describes the Beijer Electronics FreeCAN
driver in general, and some additional functionalities.
Please see this document as an addition to the driver manual. In the driver manual you
will find more detailed descriptions and some more hints.
The driver manual you will find in the driver settings in iX Developer.
Chapter 2: Describes the basic usage of this driver by creating a simple project
Please read the entire installation manual prior to installing and using this equipment.
Only qualified personnel may install, operate or repair this equipment. Beijer Electronics AB, including
all its group companies, is not responsible for modified, altered or renovated equipment. Because the equipment has a wide
range of applications, users must acquire the appropriate knowledge to use the equipment properly in their specific
applications. Persons responsible for the application and the
equip-ment must themselves ensure that each application is in compliance with all relevant requirements,
standards and legislation in respect to configuration and safety. Only parts and accessories manufactured according to
specifications set by Beijer Electronics AB may be used.
Content
1 General...............................................................................................................................3
1.1 What is CanBus? ..........................................................................................................3
1.2 What is iX FreeCAN? ..................................................................................................4
2 My first iX FreeCAN project ...........................................................................................5
2.1 What is needed for the project?....................................................................................5
2.1.1 Hardware:............................................................................................................5
2.1.2 Software: .............................................................................................................8
2.2 How should the project basically work? ......................................................................8
2.3 Create a new T7A project with demo driver ................................................................9
2.4 Parameter Definition in *.xls File ..............................................................................10
2.5 Create Parameter File in *.csv Format .......................................................................11
2.6 Installation of iXFreeCAN Driver..............................................................................11
2.7 IX FreeCAN Driver Configuration ............................................................................13
2.8 iX Demo Driver Configuration ..................................................................................15
2.9 Import of Tags out of *.csv Parameter File................................................................15
2.10 iX Tag Configuration (Controller Data Exchange)....................................................18
2.11 Connecting the Can Tags to Controls.........................................................................19
2.12 Showing Can tag timeouts..........................................................................................19
2.13 iX Runtime .................................................................................................................20
2.14 Showing FreeCAN Firmware Version .......................................................................21
3 Special protocols with FreeCAN....................................................................................22
3.1 J1939 ..........................................................................................................................22
3.2 NMEA 2000 ...............................................................................................................26
3.3 Simple CANOpenslave ..............................................................................................27
3.3.1 Simple CanOpen slave project..........................................................................27
3.3.2 Define the PDOs ...............................................................................................28
3.3.3 Define the SDOs ...............................................................................................29
3.3.4 Extending the slave with RPDOs......................................................................31
3.3.5 Extending the slave with TPDOs ......................................................................32
4 FAQs and hints................................................................................................................33
4.1 How a taglist is handled .............................................................................................33
4.2 Avoid firmware update...............................................................................................33
4.3 Different ways to write a CAN telegram....................................................................33
4.4 The use of scripts on FreeCAN tags...........................................................................34
1 General
CAN Bus (Controller Area Network) is basically an automotive bus that was developed by
company Bosch. It’s a dual wire serial protocol that was created to reduce the huge amount of
cables in cars. The maximum data transfer rate is 1MBaud. The bus must be terminated on
each end with 120 Ohm. The international ISO No is 11898.
Topology:
IX FreeCAN
=
iX Free configurable CanBus
With the FreeCAN it’s possible to connect an iX Panel to a CAN Bus system.
Therefore you need an iX Panel and a CiXFreeCAN communication module.
Base definitions for tags (CAN parameters) are done in an MS Excel sheet,
available at support page of http://www.beijerelectronics.com/ and part of the start up guide
as well.
These definitions will be loaded into the CiX-CAN Module.
2. CiX-CAN module
The CiX module has two galvanically isolated CAN interfaces, so two CAN busses can be
driven fully separated.
Interface Pinning
PIN Description
2 CAN_L
3 CAN_GND
5 CAN_SHLD
7 CAN_H
S1 S2
If the CiX module is the first / last device that is connected to a CAN cable, add an external
R120 resistor between H and L, or switch module termination to on.
LEDs
CAN cable
Termination can be switched on the base of the CAN module (see CiX-CAN module).
The length of the CAN bus cable (without repeater) depends on the baudrate.
Note: 1. For a basic cable connect all CAN_L (PIN2) to one wire and all
CAN_H(PIN7) to another wire.
Connecting CAN_GND (PIN3) is only needed for CAN Open.
2. Don’t connect more than 32 nodes on a CAN cable (without repeater).
2.1.2 Software:
Download: http://www.beijerelectronics.com/
The project will send CAN telegrams in cycles (1 second) on CAN1 channel and receives
them on CAN2. For the cyclic send we use the internal iX Demo driver, as this driver has
some cyclic counter tags. CAN1 and CAN2 channels must be directly connected via CAN
cable.
Procedure:
Install two drivers in an iX project
a) DEMO driver for cyclic tag writing
b) FreeCAN driver for CAN data exchange
Start iX Developer
Select T7A
Press Next
Press Next
Press Finish
In the sample project iX_Can1ToCan2_T7A you will find a folder named Project Files
with a file Can1ToCan2.xls.
Copy that file to the new project in its Project Files folder.
This Microsoft Excel file is used as a template definition file, where you are able to define
the access to the CAN telegrams. Basically you enter the tag name, the CAN header address
and the value bits in the data field.
See example:Can1ToCan2.xls file where already 2 Tags / CAN parameters are entered:
The receive list can save up to 3500 CAN telegrams, meaning that 3500 different CAN-ID’s
can be saved.
Now the *.xls parametertemplate file must be saved in the format CSV (MS-DOS).
If you know that the correct driver is already installed, please continue with 2.7
Otherwise check if the driver is installed and which version.
Go to Function Controllers. 1 Controller is already entered. (DEMO Driver).Click on Add.
If no FreeCAN Controller can be selected you have to install the driver first.
Go to Screen ComboBox
Note: On occurrence of problems in the FreeCAN driver installation, please make sure that
you have full administration rights on your system and that iX Developer is started in
administration mode.
The default setting of the FreeCANdriver defines the used baud rate of 250 kbaud.
Please check that the used COM port is set to COM5 (for TxA and TxB panels; for TxC
check the settings in the device manager to get the correct COM port).
For the cyclic writing on CAN1 channel the Demo driver can be used. As default the C0
Counter increments from 0 … 100 and decrements from 100 … 0.
Import to the FreeCAN Controller opens the dialog Import Tags with the special FreeCAN
import format. Pressthe Browse Button:
Select your Can2ToCan2.csv file (make sure that you have selected the correct folder)
and press Open.
If the *.csv file is a valid import file it’s possible to press Import.
The tag tree view opens. Select All Items and press OK.
Hint:
Use the option ”merge“ if you import
the tags for the second time.
This import produces in parallel a file named taglist.lst, which is a tag reference list.
This reference list will be loaded automatically into the CAN module when the driver loads.
Enable the Data Exchange columns by clicking the checkbox Data Exchange.
Enter C0 (Counter Tag) in the DEMO Controller column for the tag Can1.
Then press the Direction Browse Button for tag Can1.
That means that counter Tag C0 increments the value of tag Can1 in a cycle.
Place two Controls Analog Numeric on your screen and connect them with tags Can1 and
Can2. This can be done in Tag/Security.
As we remember, we gave our Can1 and Can2 tags a timeout value of 2000 ms.
Doing that, the tags will be automatically doubled on import:
1.) the value itself
2.) a so called valid bit.
After importing the *.csv parameter file we get the timeout tags: [Tag_Valid]
The valid bit returns 0 if the CAN telegram was not received on CAN bus within timeout time.
The valid bit returns 1 if the CAN telegram was received on CAN bus within timeout time.
Enter 0 for Start and End value and change the color to red.
Enter 1 for Start and End value and change the color to green.
Now there are two coloured fields that get red, if the Can1 or Can2 tag was not received
within 2 seconds.
2.13 iX Runtime
On CAN Bus you can get the following information (Example recorded with a CAN
analyzer):
Every second a CAN telegram with header 0x123456 is written, and the value is
incremented by 1.
CAN1 and CAN2 channels are connected to each other and communication works.
The incremented value of CAN1 will be transferred and will be the same at CAN2.
Also both valid bits are true = green.
CAN1 and CAN2 channel are not connected to each other and communication does not
work.
The incremented value of CAN1 will not be transferred, and will not be the same at CAN2.
Can2 valid bit is false = red.
Change Tag1 or add a new Tag Firmware Version. Enter HV in the address column:
Add an additional Analog Numeric control on the screen and connect it to the Firmware
Version tag.
The driver will deliver a value like 2900, this means Firmware version 29.
If you want to show the basic version number (=29), switch on Scaling for the tags and
insert the value 0,01 for the tag in Gain.
3.1 J1939
Note:
- Bit 24: Data Page (0 for J1939)
- Bit 25: reserved (= 0)
Definition:
- SA (Source Address)
Specifies the address of the sending CAN device. Sometimes it is called transmitter
address.
Assumed, the transmitter address= 0 and the priority =3, the header is:
Hints:
1. SAE counts up from 1, we have to use byte 3 and byte 4 in the Excel sheet.
2. Resolution 0.125 rpm/bit with 0 offset.
Summary:
- Engine_speed will be the imported tag name.
- 0x0CF00400 is the CAN header adress.
- Can bus is on CAN1 plug (channel 1).
- Timeout will produce a valid bit tag =Engine_Speed_Valid on import.
- “J1939” in Protocol will fill unused data bits with 1 (default).
- Gain is 0,125 for SPN190.
- J1939 is Intel formatted, with low byte on left side (Byte 3), high on the right (Byte4).
Note:
- Bit 24: Data Page (1forNMEA 2000)
- Bit 25: reserved (= 0)
There are NMEA variables that have a variable inside the data, which extends the header.
Normally this would cause a problem to separate the variables. For this we inserted a special
protocol “PROT14”. Together with the numbers 200 and 201 in a bit column in the Excel
sheet it is possible to filter the variable. The number 200 represent a 0 and the number 201
represents a 1.
Example:
With this filter applied we get the value of tag NMEAvar1 if telegram 0x19F21100 (PGN
1F211) has the value 0x20 in the first byte.
CANOpen is a dedicated complex bus protocol. With FreeCAN we can only build a simple
CanOpen slave.
The simple CanOpen Slave functionality is supported in FreeCAN driver version 5.00.35and
CiX firmware version 29 or higher.
- FreeCAN_08_CanOpen
A simple CanOpen slave 7, 1 TPDO, 1 RPDO on FreeCAN driver.
Use FreeCAN_08.EDS in folder /Project Files.
- canOpen_master_08
A CanOpen master 1 with automatic config, 1 TPDO, 1 RPDO on CanOpen driver
(Firmware CanOpenV6 needed).
Start both TxA panels together. At start the master will poll the SDO settings from slave and
start a data exchange. As we connected both iX projects to the demo driver counter, you will
see the data running.
With FreeCAN firmware V29 (in driver 5.00.36) we implemented a new protocol
“CanOpen”, which allows you to use the FreeCAN driver as a simple CanOpen slave.
We base this document on the FreeCAN manual (in the FreeCAN driver).
So read them first to understand the way we handle things.
Also CanOpen spec “DS401” should be known to you.
Please be aware that you use this driver on your own risk, as we did not certificate it. But it
should be good enough to meet the basic needs of a CanOpen slave communication.
If you want to use a certificated CanOpen master or slave with our panel, we offer a special
driver and firmware for it. Please contact your local Beijer dealer.
The RPDOs (input) are stored in the CAN module and can be used as read tags.
The TPDOs are written on tag change in iX project. The telegrams can be send cyclic.
The example project comes with a useable EDS, which allows you to build a quick
CanOpen network. You may change the Excel sheet and the EDS to your demands.
The slave number in the example project is set to 7. If you want to change it, you may
change controller setting “Can station address” in FreeCAN driver. This changes the
reaction on NMT telegram.
The PDOs (process data objects) telegrams are the exchanged data over CanOpen (only in
Operational state).
To define the PDOs, the tags for iX program have to be defined. Set “CanOpen” in Protocol
row to mark it as CanOpen telegrams. The name extension “.BYTE” (RPDO_0_8.BYTE)
will import the tag as a INT16 tag, which is the nearest iX type to Byte.
As CanOpen defaults, the PDO IDs in CanOpen are set like this:
RPDO1 = 0x200 + Slave number
TPDO1 = 0x180 + Slave number
RPDO2 = 0x300 + Slave number
TPDO2 = 0x280 + Slave number
So here for our slave no 7 we get: RPDO1= 0x207, TPDO1=0x187
In this example we defined 1 TPDO1 and 1 RPDO1. The mapping for both is 4 tag bytes
and one doubleword (32bit) tag. Below you see the Excel setting for the 5 RPDO and 5
TPDO tags.
Here RPDO1_0_8 has a additional value tag (RPDO1_0_8_Valid) produced by the Timeout
setting. This tag can be used to test, if data over RPDO comes in.
With the definition of the SDOs the CanOpen configuration of the slave can be set. In the
Excel sheet you define the answers of the slave to the requests of the master. Therefore the
first data byte 0 holds the respond-code 0x43 = SDO respond with 4 data bytes. Byte 1 to 3
are the SDO index and subindex, inserted by the firmware, so you do not have to define it.
Byte 4 to 7 are the SDO data. Read the SDO data from right to left, as in CanOpen the data
come Intel-like, which is low, high (byte 4 is the lowest byte, byte 7 the highest).
All “not defined” SDOs are automatically denied on master request, you do not have to do
anything.
For “CanOpen” we have a special Excel sheet agreement: “1” is a fixed on bit, “0” is a fixed
off bit.
So 10010011 = 0x93 fixed.
It is important that you understand, that this slave is NOT configurable (writeable) over Can
Bus. All features are fixed in the Excel list. But the slave responds to SDO uploads. It is to
your responsibility to have SDOs and PDOs matching each other.
There are some basic SDOs, that an I/O slave have to bring along (see CanOpen DSP401).
SDO 1000,0 (Slave Type).
Read as SDO 1000, subindex 0. Here we return 0,0,0,0 which means: nothing special.
If the master sends SDO 1017,0 (Heartbeat producing time), the slave repeats heartbeat-
telegrams on this time rate.
If the master sends SDO 1016,1 (Heartbeat consuming time), the slave timeouts heartbeats
and turns to preoperational, if heartbeat from master timeouts.
1000,0 43,-,-,-,0,0,0,0
1018,1 43,-,-,-,45,1,0,1
1018,2 43,-,-,-,0,0,0,0
1018,3 43,-,-,-,0,0,0,0
1018,4 43,-,-,-,0,0,0,0
If you change the Excel sheet, do not forget to save it as *.csv (MS-DOS) and import it to
your iX project.
SDO 1A01,1 (TPDO2 mapping obj1) = 0x64110108 = obj 6411,1 with 16 bits
SDO 1A01,2 (TPDO2 mapping obj2) = 0x64110208 = obj 6411,2 with 16 bits
SDO 1A01,3 (TPDO2 mapping obj3) = 0x64110308 = obj 6411,3 with 16 bits
SDO 1A01,4 (TPDO2 mapping obj4) = 0x64110408 = obj 6411,4 with 16 bits
Hint:
If you want a TPDO to be send cyclic, set the cyclic time in row “Send Cycle[ms]”.
Example: 1000 would send the TPDO telegram every second AND every time the value
changes.
Please mind, that first send of TPDO is done on the first tag change in iX program (or a tag
write in the iX init).
A taglist is produced, if an Excel file is imported. A taglist is a reference list, that shortens
the access to variables. Instead of “Give me address 1234 with mask 5678 on channel 1…”
we say “give me listvalue 1”. Therefore the taglist must be loaded into the CiX module
before communication starts. The driver does this automatically. Another advantage is, that
an Excel sheet gives a better overview and a lot of tags can be inserted in a project in one
step.
Example: the use of the same project for CAN device 3 or 4. Make Excel for device 3 and
import it into your project. Save taglist.lst as taglist3.lst. Then make Excel for device 4 and
import it into your project. Save taglist.lst as taglist4.lst. If you want to load device3, just
copy taglist3.lst on taglist.lst and download project. If you want to load device4, just copy
taglist4.lst on taglist.lst and download project.
Reasons for this could be the use of a special firmware or the freeze of software.
Every tag in Excel sheet can be written by the iX project. Normally the CAN module
takes the last received or send data and overwrites just the value.
By the use of protocol “J1939” the rest of the telegram is filled with “1”(=unused).
If a data outside the value should have other value, it is possible to force the data by
setting 100(Bit=0) or 101(Bit=1).
a) by direct commands
Hint: the cyclic write starts after a value is written to it, then it runs cyclic. For a start in iX
write a “script.init” function and write a value to the tag by e.g. “globals.tags.setAnalog(0)”.
Tags can be read or written in scripts. But be aware, that the data flow is controlled by the
driver and there is no absolute way to force a data exchange at a certain moment. Also the
driver changes the order of write and read tags. If the order must be kept, it is necessary to
collect the script tags commands in a recipe.
Scripts, which are placed in Tags/scripts (e.g. in ValueChange) cause the driver to read the
tag constantly. Please be aware, that this can lead to slow data communication (if too many
tags are read).
Please remember: Tags, that are shown in Analog Numeric, are only read on active screen.