9 SDF - The session description file
1, Overview
A SDFile contains the configuration to setup a Baby-LIN-Device. It contains among other things the following information:
A SDFile can be downloaded into a device and even stored persistently using the SimpleMenu or the Baby-LINDLL.
2, Channels and sections
2.1 Introduction
With the introduction of the second generation of Baby-LIN products and SDF-V3, the full support for multiple bus interfaces was added.
Each bus interface on a Baby-LIN product is now represented by a channel. Each channel has its own set of SDF features like virtual signals, signal functions, macros, events etc..
A SDFile in the SDF-V2 format describes the configuration of a single bus. This configuration is now called a section and a SDFile in the SDF-V3 format can contain more than one section.
The following chapters explain channels, section and the mapping from sections to channels when a SDFile is loaded.
2.2 Sections
A channel is configured by a section from a SDFile. Each section has its own set of SDF features like virtual signals, signal functions, macros, events etc..
A SDFile in SDF-V2 format only has a single section. That section contains the configuration for the single LIN channel and the device channel.
A SDFile in SDF-V3 format always has a device section. Additionally it can keep any number of LIN and CAN sections.
2.3 Channels
Each bus interface of a Baby-LIN product is represented by a channel. Each channel is configured with a single section from a SDFile. The following channel types are available:
The following channels are available for the Baby-LIN-Devices.
2.4 Mapping of the sections to channels
When a SDFile is loaded, its sections must be mapped to the channels of the Baby-LIN-Device. The following algorithm is applied:
The sections of the SDFile are loaded in order from the beginning to the end. They are mapped in the order they appear in the SDFile. A LIN section is mapped to the next unused and activated LIN channel. A CAN section is mapped to the next unused and activated CAN channel. If no more LIN or CAN channels are available, the remaining sections are discarded. The device section is always mapped to the device channel.
2.5 Section Properties
Each section has some common properties and a set of individual properties and information, that describe that section. The following table shows these properties:
2.5.1 Baudrate
When selecting the Baudrate, a distinction must be made between whether the Baby-LIN-Device is to be operated in master or slave mode. In slave mode the following applies:
Behavior as Slave
According to the LIN Spec for the Baudrate of the LIN bus communication, it can be operated between 1 and 20 [kbit/s] second. Our baby LIN devices support a Baudrate that exceeds this specification. In addition, our Baby-LIN units have integrated Baudrate synchronisation between master and slave. Up to a Baudrate of 22 [kbit/s], the Baudrates of the bus participants are adjusted and an error message is thrown if the deviation is too large. If you want to use a Baudrate higher than 22 [kbit/s], this must be set explicitly in the SDF. The following table shows the behaviour with regard to the different Baudrates.
Behavior as Master
For the Baudrate of the Baby-LIN-Device as master the following minimum and maximum limits result.
• Max Baudrate: 115200 [Bit/s]
• Min Baudrate: 2400 [Bit/s]
3, Virtual Signals
3.1 Introduction
Signals are small sections of LIN frames. They are defined in the underlying LDFile.
The SDFile provides the opportunity to define virtual signals. They are mostly handled like normal bus signals. The main difference is that they are defined in the SDFile instead of the LDFile.
The virtual signals can be used for many purposes. Here are some common use cases:
• They can be used as buffer or interim results for calculations.
• They can be used as auxiliary variables like counters or state variables.
• They can be used as trigger for signal events.
• They are required for custom protocols. Check chapter "Custom Protocols" for more information.
• The give access to system specific resources. Check chapter "System variables" for more information.
3.2 Size
The size of a virtual signal in the SDF-V2 format is for compatibility reasons always 16 Bit and unsigned. The SDF-V3 allows for sizes between 1 to 64 Bit and also signed values.
An exception to this scheme are system variables. They are always 32 Bit and unsigned. Check chapter "System variables" for more information.
3.3 Scope
The scope of a virtual signal is limited to the section it is defined in. Therefor a channel has one instance for every virtual signal in the section, that was loaded to that channel.
It is not possible to share values of regular virtual signals over multiple sections, even if the name of a virtual signal is identical.
To realize this special system variables are available. Check chapter "@@SYSGLOBAL" for more information.
Warning
Since each channel has its own instance of system variables (except "@@SYSGLOBAL"), single system specific resources may be accessed concurrently by multiple channels. Please organize your system variable access accordingly. One solution could be, to access single system resources only from a single channel.
3.4 Reset on bus start
Virtual signals can react differently to a bus start. The following table gives you an overview:
Version incompatitbility
To keep the backward compatibility, the state of all virtual signals is set to reset on bus start, when converting a SDF-V2 to a SDF-V3. Accordingly you can only convert a SDF-V3 to a SDF-V2, if the state of all virtual signals is set to reset on bus start.
4, System variables
4.1 Introduction
System variables are virtual signals with reserved names. They allow access to system specific resources like timers, inputs and outputs etc..
Before you can use these system variables, they need to be added to the virtual signals. You can easily identify the system variables since they always start with the "@@" string.
The size of system variables is always 32 Bit and they are always unsigned.
There are 3 types of system variables:
System variables do not all react in the same way on bus starts. Some are reset to their initial value like normal virtual signals while others are never reset:
Some system variables are read-only. Setting them will be ignored.
4.2 System Variable Wizard
You can add and change additional system signals under the Virtual Signals tab in SessionConf. There is an extra System Varibale Wizard that lists all system signals and explains their function and use. The user interface can be called up via the button "Add system signal".
The system signals are subdivided thematically and, in addition, the signals can be displayed according to availability at the individual Baby-LIN-Devices.
In parallel to the short description, there is also a detailed description with possible values, which the signals can assume.
5, Macros
5.1 Overview
A macro consists of one or more macro commands. Each of these macro commands are single instructions, that allow you to modify signals, bus states, the macro flow and much more. Each macro command has its own parameters.
Version incompatitbility
Not all macro commands are available in SDF-V2, but only in SDF-V3.
The execution of a macro command can be conditional. Then it is only executed, if the condition is fulfilled.
5.2 Command labels
Each macro command can get a label. This label is just a textual marker, but is very helpful to mark certain sections within a macro. A label can also be used to clarify the target command of a jump command. Check chapter "Flow control commands" for more information.
5.3 Local macro variables
Version incompatitbility
This feature is only available in the SDF V3 format. Depending on your device you may require an additional activation code. An update to the newest firmware is required.
The following system variables are availbale only within the scope of a macro and can only accessed within this macro. You can not access their values outside of a macro.
They are especially useful, to store local or temporally values within them, without the need to create "Virtual Signals" . They can also be used to return a value from a macro, which makes the macro reusable.
5.4 Macro conditions
Each macro command can be provided with a condition. This means that the command is only executed if the condition is fulfilled. If this is not the case, the command is simply skipped by SessionConf. This allows further logical processes to be programmed in the SDF.
The condition setting can compare all bus, virtual and system signals with each other or with constants. All relational operators are available for this purpose. The following table shows the individual functions.
Warning
When comparing signals with different lengths and signs, it must be noted that the signals can only be compared with each other in their valid value range. If signals with invalid values are initialised, this will cause the variable to be cast. As a result, the signal contains the maximum value, which can lead to logic errors when using conditions.