Localbus protocol description

Description of Gantner Instruments' proprietary Localbus protocol

Localbus protocol

1. Document history

Version Date Comment
V1.50 2015-04-10 @ “Get device identification” positive response details added;
V1.40 2015-04-01 Commands “Get variable single extended” and “Set variable single extended” added;
V1.30 2014-12-01 @ “Set slave execution state” state 0x02 added;
V1.20 2014-05-22 Structural changes of the document;
V1.20 2014-02-19 Calculation of CheckSum-segment checksums with wrong mod value: 256 instead of 65536;
V1.10 2013-11-25 Read/write file description added;
    Some details added;
V1.00 2013-07-10 First version in DokuWiki;

2. General

The protocol described in this document is used for communication with e.series, Q.series, and Q.series X I/O modules.

3. Character format

The general character format for the Localbus will be 8e1 (1 Start Bit / 8 Data Bits / Even Parity / 1 Stop Bit).

4. Transmission order

The transmission order is MS-Byte before LSB-Byte with LS-Bit before MS-Bit.

5. Baud rates

  • 19.2 kBaud (e.series/Q.series/Q.series X)
  • 38.4 kBaud (e.series/Q.series/Q.series X)
  • 57.6 kBaud (e.series/Q.series/Q.series X)
  • 115.2 kBaud (e.series/Q.series/Q.series X)
  • 187.5 kBaud (e.series/Q.series/Q.series X)
  • 500 kBaud (e.series/Q.series/Q.series X)
  • 1.5 MBaud (e.series/Q.series/Q.series X)
  • 3 MBaud (Q.series/Q.series X)
  • 6 MBaud (Q.series/Q.series X)
  • 12 MBaud (Q.series/Q.series X)
  • 24 MBaud (Q.series/Q.series X)
  • 48 MBaud (Q.series X)

6. Communication procedure

The communication will always be initiated by a master system (PC, controller, …). The slave will answer in a proper way with a defined max. answer delay time. Each request must be answered with a response. If no response will be received within a certain time (max. answer delay time) the master must recognize it and start a user-defined error procedure. An incorrect or not implemented command for the slave will be answered with a 'NAK' by the slave – command not available.

We distinguish between

  • addressed communication (for baud rates lower or equal to 115.2 kBaud)
  • broadcast communication (for baud rates higher than 115.2 kBaud)

7. Addressed communication

7.1 Timing

The response delay (time between request and response) will be within the interval tMin to tMax. After the response a tIdle time is necessary. That means nothing is allowed to be on the bus. Afterward, all slaves of the bus system will be ready to receive new data.

tIdle REQUEST tMin/tMax RESPONSE
 
tIdle =       min. 3 chars
tMin = 0.5 µs
tMax = 0.5 s
 

7.2 Basic build-up

7.2.1 Request-Frame
Sync2 Addr L Cmd RequData FCS
 
Sync2:        Start delimiter for single address communication = 0xA6          UINT1
Addr: Address of slave UINT1
L: Length of data = Cmdxx + RequData[] UINT1
Cmd: The command specifies the sense of data which are following UINT1
RequData: Request data UINT1 ARRAY
FCS: Frame checksum = (Addr + L + Cmd + RequData[]) mod 256 UINT1
e.g.:         0xA6 | 0x02 | 0x01 | 0x0A | 0x0D

7.2.2 Response-Frame positive without data

SQ
 
SQ:           Short quit = 0xE5                                                UINT1
 

7.2.3 Response-Frame positive with data

ACK Addr L RespData FCS
 
ACK:          Start delimiter for a positive response with data = 0xB6         UINT1
Addr: Address of slave UINT1
L: Length of data = RespData[] UINT1
RespData: Response data UINT1 ARRAY
FCS: Frame checksum = (Addr + L + RespData[]) mod 256 UINT1
e.g.:         0xB6 | 0x02 | 0x02 | 0x01 | 0x00 | 0x04
 

7.2.4 Response-Frame negative

NAK Addr L ErrorCode FCS
 
NAK:          Start delimiter for a negative response with data = 0xC6         UINT1
Addr: Address of slave UINT1
L: Length of data = ErrorCode UINT1
ErrorCode: Error code of slave: UINT1
0x01: Command not available error
0x02: Invalid parameter or sub command received error
0x03: File not open error
0x04: Write to flash error
0x05: Write to variable error
0x06: Illegal file index error
0x07: Illegal variable index error
0x08: Illegal sub variable index error
0x09: Sub process timeout (e.g. EE read access timeout)
0x0A: Busy
FCS: Frame checksum = (Addr + L + ErrorCode) mod 256 UINT1
e.g.:         0xC6 | 0x02 | 0x01 | 0x01 | 0x04

7.3 File index table

Overview of available files.

Index Name Appendix
0x00 Interface File _i.gcf
0x01 Configuration File _c.gcf
0xFC Calibration File _cal.gcf
 

7.4 File structure

Each file consists of a CheckSum-, Length-, Header- a FileData-section. This is needed to store/decode checksums, length, and additional needed parameters.

ATTENTION for Header-Padding-Section:

  • @Write: Not needed at the moment.
  • @Read: Can be present, so decoding software needs to take care of it. If not existing, also LPAD is NOT present.
 
7.4.1 Standard profile
CheckSum-Section (each calculated as Sum of data mod 65536):
CheckSum of Length-Section UINT2
CheckSum of Header-Section UINT2
CheckSum of FileData-Section UINT2
Length-Section:
Length of Header-Section (LH) UINT2
Length of FileData-Section (LF) UINT2
Header-Section:
Length of DateTime (LDT) UINT1
DateTime ('yyyymmddhhmmss') LDT x UINT1
Length of Name (LN) UINT1
Name LN x UINT1
Header-Padding-Section:
Length of PaddingData (LPAD) UINT1
PaddingData LPAD x UINT1
FileData-Section:
FileData LF x UINT1
 
7.4.2 DirectTag profile (0x01,0x02,0x03)
CheckSum-Section (each calculated as Sum of data mod 65536):
CheckSum of Length-Section UINT2
CheckSum of Header-Section = 0xFFFF UINT2
CheckSum of FileData-Section UINT2
Length-Section:
Length of Header-Section (LH) UINT2
Length of FileData-Section (LF) = 0xFFFF UINT2
Header-Section:
Length of DateTime (LDT) = 0x00 UINT1
Length of Name (LN) = 0x04 UINT1
Name = TagID LN x UINT1
Length of ProfileNumber (LP) = 0x01 UINT1
ProfileNumber = 0x01,0x02,0x03 LP x UINT1
Length of Attributes (LA) UINT1
Attributes LA x UINT1
Header-Padding-Section:
Length of PaddingData (LPAD) UINT1
PaddingData LPAD x UINT1
FileData-Section:
FileData LF x UINT1

7.4.3 Extended profile (0x0A)

CheckSum-Section (each calculated as Sum of data mod 65536):
CheckSum of Length-Section UINT2
CheckSum of Header-Section UINT2
CheckSum of FileData-Section UINT2
Length-Section:
Length of Header-Section (LH) UINT2
Length of FileData-Section (LF) = 0xFFFF UINT2
Header-Section:
Length of DateTime (LDT) UINT1
DateTime ('yyyymmddhhmmss') LDT x UINT1
Length of Name (LN) UINT1
Name LN x UINT1
Length of ProfileNumber (LP) = 0x01 UINT1
ProfileNumber = 0x0A LP x UINT1
Length of ExtFileLength (LLEF) UINT1
ExtFileLength LLEF x UINT1
Length of Attributes (LA) UINT1
Attributes LA x UINT1
Header-Padding-Section:
Length of PaddingData (LPAD) UINT1
PaddingData LPAD x UINT1
FileData-Section:
FileData LF x UINT1

7.5 Get diagnostics

This command is used to read the actual diagnostic data of the slave.

7.5.1 Request

Sync2 Addr L Cmd FCS
 
L:            Length of data = 0x01                                            UINT1
Cmd: Command: GetDiag = 0x02 UINT1

7.5.2 Positive response

ACK Addr L DiagData FCS
 
L:            Length of data                                                   UINT1
DiagData: Diagnostic data UINT1 ARRAY
L = 4: 1 x UINT2 SlaveState + 1 x UINT2 VariableState
L = 6: 1 x UINT2 SlaveState + 1 x UINT4 VariableState

SlaveState-bitset
0x0001: EEPROM-error
0x0002: FLASH-error
0x0004: ADC-error
0x0008: CONFIG-error
0x0010: FPGA-error
0x0020: RTC-error
0x0040: INTERNAL-BUS-error
0x0080: IO-OVERCURRENT-error
0x0100: SOCKET-EEPROM-error
0x0200: ADDRESS-FROM-DIP-SWITCH
0x0400: CONFIG-FROM-SOCKET
0x0800: WRONG-HARDWARE-EXTENSION-error
0x1000: CALIBRATION-FROM-HARDWARE-EXTENSION
0x2000: NO-EEPROM-ON-HARDWARE-EXTENSION

VariableState-bitset
Each bit represents one variable starting with V1 corresponding with B0.
In case of AnalogInput variable, this bit setted means RANGE-error, otherwise it is a GENERAL-error.

7.6 Get device identification

This command is used to read the device identification parameters of the slave.

7.6.1 Request

Sync2 Addr L Cmd FCS
 
L:            Length of data = 0x01                                            UINT1
Cmd: Command: GetDeviceIdent = 0x0D UINT1

7.6.2 Positive response

ACK Addr L LV Vendor LDT DeviceType LHWR HWRelease LSWR SWRelease FCS
 
L:            Length of data                                                   UINT1
LV: Length of vendor string UINT1
Vendor: Vendor of the slave: e.g. "Gantner” UINT1 ARRAY
LDT: Length of device type string UINT1
DeviceType: MainName[/SubCode/CasingCode]: e.g. "Q.bloxx D101/0/101” UINT1 ARRAY
LHWR: Length of hardware release string UINT1
HWRelease: OSName[/FPGAName]: e.g. "x00.50/g00.60” UINT1 ARRAY
LSWR: Length of software release string UINT1
SWRelease: APPName: e.g. "a00.72” UINT1 ARRAY

7.7 Get variable all

This command is used to read the actual value of all defined variables of the slave.

 7.7.1 Request

Sync2 Addr L Cmd FCS
 
L:            Length of data = 0x01                                            UINT1
Cmd: Command: GetAllVar = 0x0A UINT1

7.7.2 Positive response

ACK Addr L Value1 Value2 ….. ValueX FCS
 
L:            Length of data                                                   UINT1
ValueX: Values to be transmitted According configured sizes

 7.8 Get variable single

This command is used to read the actual value of one defined variable of the slave.

 7.8.1 Request

Sync2 Addr L Cmd VarInd FCS
L:            Length of data = 0x02                                            UINT1
Cmd: Command: GetSingleVar = 0x0B UINT1
VarInd: Variable index starting with 0 for first UINT1

 7.8.2 Positive response

ACK Addr L Value FCS
 
L:            Length of data                                                   UINT1
Value: Value to be transmitted According configured size

 7.9 Set variable single

This command is used to write the actual value of one defined variable of the slave.

 7.9.1 Request

Sync2 Addr L Cmd VarInd Value FCS
 
L:            Length of data                                                   UINT1
Cmd: Command: SetSingleVar = 0x0C UINT1
VarInd: Variable index starting with 0 for first UINT1
Value: Value to be set According configured size

 7.9.2 Positive response

SQ
 

7.10 Get variable single extended

This command is used to read the actual value of one defined variable of the slave, including the selection of sub-values.

 

7.10.1 Request

Sync2 Addr L Cmd VarInd VarSubInd FCS
 
L:            Length of data = 0x03                                            UINT1
Cmd: Command: GetSingleVarEx = 0x14 UINT1
VarInd: Variable index starting with 0 for first UINT1
VarSubInd: Selection index of sub value: UINT1
0x00: NETVALUE
0x01: TAREVALUE
0x02: GROSSVALUE
0x03: ZEROVALUE
0x04: UNBALANCEDVALUE
 

7.10.2 Positive response

ACK Addr L Value FCS
 
L:            Length of data                                                   UINT1
Value: Value to be transmitted According configured size
 

7.11 Set variable single extended

This command is used to write the actual value of one defined variable of the slave, including the selection of a subvalue.

 

7.11.1 Request

Sync2 Addr L Cmd VarInd VarSubInd Value FCS
 
L:            Length of data                                                   UINT1
Cmd: Command: SetSingleVarEx = 0x15 UINT1
VarInd: Variable index starting with 0 for first UINT1
VarSubInd: Selection index of sub value: UINT1
0x00: NETVALUE
0x01: TAREVALUE
0x02: GROSSVALUE
0x03: ZEROVALUE
0x04: UNBALANCEDVALUE
Value: Value to be set According configured size
 

7.11.2 Positive response

SQ
 

7.12 Set slave execution state

This command is needed to put the state machine of slaves in a certain state.

 

7.12.1 Request

Sync2 Addr L Cmd State FCS
 
L:            Length of data = 0x02                                            UINT1
Cmd: Command: SetExecState = 0x0E UINT1
State: State of state machine UINT1
0x00: stop
0x01: start with actual busparameters
0x02: start with full reinit (busparameters from file)
 

7.12.2 Positive response

SQ
 

7.13 Open flash file for reading

This command is used to open a flash file for read.

 

7.13.1 Request

Sync2 Addr L Cmd FileIndex FCS
 
L:            Length of data = 0x02                                            UINT1
Cmd: Command: OpenReadFlash = 0x03 UINT1
FileIndex: Index of file to be opened UINT1
 

7.13.2 Positive response

SQ
 

7.14 Open flash file for write

This command is used to open a flash file for write.

 

7.14.1 Request

Sync2 Addr L Cmd FileIndex FCS
 
L:            Length of data = 0x02                                            UINT1
Cmd: Command: OpenWriteFlash = 0x04 UINT1
FileIndex: Index of file to be opened UINT1
 

7.14.2 Positive response

SQ
 

7.15 Read data from the flash file

This command is used to read data from an opened flash file.

 

7.15.1 Request

Sync2 Addr L Cmd AddrOffset DataLength FCS
 
L:            Length of data = 0x04                                            UINT1
Cmd: Command: ReadFlash = 0x05 UINT1
AddrOffset: Address to start reading from opened file (starting @0x00). UINT2
DataLength: Length of data to be red (max. 0x80). UINT1
 

7.15.2 Positive response

ACK Addr L Data FCS
 
L:            Length of data                                                   UINT1
Data: File data UINT1 ARRAY
 

7.16 Write data to flash file

This command is used to write data to an opened flash file.

 

7.16.1 Request

Sync2 Addr L Cmd AddrOffset DataLength FCS
 
L:            Length of data                                                   UINT1
Cmd: Command: ReadFlash = 0x06 UINT1
AddrOffset: Address to start writing to opened file (starting @0x00). UINT2
DataLength: Length of data to be written (max. 0x80). UINT1
Data: File data UINT1 ARRAY
 

7.16.2 Positive response

SQ
 

7.17 Close flash file

This command is used to close an opened flash file and terminate accessing it.

 

7.17.1 Request

Sync2 Addr L Cmd FCS
 
L:            Length of data = 0x01                                            UINT1
Cmd: Command: CloseFlash = 0x07 UINT1
 

7.17.2 Positive response

SQ
 

8. Broadcast communication

 

8.1 Timing

After the response, idle time is necessary. That means nothing is allowed to be on the bus. Afterward, all slaves of the bus system will be ready to receive new data.

tIdle REQUEST-FRAME tResDel RESPONSE-SUB-FRAME1 tGap RESPONSE-SUB-FRAME2 tGap RESPONSE-SUB-FRAMEn
 
tIdle =         min. 3 chars
tResDel = ~1 char
tGap = 1 char

8.2 Slave scan

This command is used to get basic information on all connected slaves.

8.2.1 Request-Frame

Sync3 L Cmd FCS
 
Sync3:          Start delimiter for broadcast slave scan = 0xA7                UINT1
L: Length of frame = Cmd UINT1
Cmd: Command = 0x00 UINT1
FCS: Frame checksum = (L + Cmd) mod 256 UINT1
e.g.:           0xA7 | 0x01 | 0x00 | 0x01
 

8.2.2 Response-Frame

AS1 MkS1 PrS1 BrS1 CfS1 FCSS1 ASn MkSn PrSn BrSn CfSn FCSSn
 
Slave 1:
...
Slave n:
ASn: Address UINT1
MkSn: Slave module kind main code UINT2
PrSn: Configured protocol code UINT1
0x00: Profibus
0x01: Modbus
0x02: Profibus DP
0x03: Localbus
BrSn: Baudrate UINT2
1922: 19k2
3842: 38k4
11522: 115k2
18752: 187k5
55: 500k
155: 1M5
36: 3M
66: 6M
126: 12M
246: 24M
486: 48M
CfSn: CharFormat UINT1
0x00: 8N1
0x01: 8E1
0x02: 8O1
0x04: 8N2
0x05: 8E2
0x06: 8O2
FCSSn: SubFrame checksum = (ASn + MkSn + PrSn + BrSn + CfSn) mod 256 UINT1
e.g.:           0x01 | 0x00 | 0x10 | 0x03 | 0x00 | 0xF6 | 0x01 | 0x0B |
0x02 | 0x00 | 0x10 | 0x03 | 0x00 | 0xF6 | 0x01 | 0x0C |
0x03 | 0x00 | 0x16 | 0x03 | 0x00 | 0xF6 | 0x01 | 0x13
=> 3 Slaves
Slave 1:
Address = 1
Slave module kind main code = 16 => Q.bloxx A107 series
Protocol = 3 => Localbus
Baudrate = 246 => 24MBaud
CharFormat = 1 => 8e1
Slave 2:
Address = 2
Slave module kind main code = 16 => Q.bloxx A107 series
Protocol = 3 => Localbus
Baudrate = 246 => 24MBaud
CharFormat = 1 => 8e1
Slave 3:
Address = 3
Slave module kind main code = 22 => Q.bloxx D105 series
Protocol = 3 => Localbus
Baudrate = 246 => 24MBaud
CharFormat = 1 => 8e1
 

8.3 Value transfer

This command is used for speed-optimized transfer of input/output values of all connected slaves.

8.3.1 Request-Frame

Sync2 LS1 AS1 DS1 FCSS1 LSn ASn DSn FCSSn LSn+1
 

Sub-frames for slaves, which have NO output data, are completely removed. The last UINT1 must be 0x00, which indicates the length of the following (not present) slave.

Sync2:          Start delimiter for broadcast value transfer = 0xA5            UINT1
Slave 1:
...
Slave n:
LSn: Length of sub-frame = ASn + DSn[] + FCSSn UINT1
ASn: Address UINT1
DSn: Output values to be transmitted According configured sizes
FCSSn: SubFrame checksum = (LSn + ASn + DSn[]) mod 256 UINT1
Slave n+1:
LSn+1: Length of not present next slave sub-frame = 0x00 UINT1
e.g.:           Frame for 2 slaves with output data, having address 1 (2 float variables) and 2 (1 float variable):
0xA5 | 0x0A | 0x01 | 0x3F | 0x80 | 0x00 | 0x00 | 0x40 | 0x00 | 0x00 | 0x00 | 0x0A | 0x06 | 0x02 | 0x43 | 0x7F | 0x00 | 0x00 | 0xCA | 0x00
Frame for slaves, having no output data:
0xA5 | 0x00
 

8.3.2 Response-Frame

AS1 LS1 DS1 FCSS1 ASn LSn DSn FCSSn
 

Sub-frames for slaves, which have NO input data, are also included in response, to have knowledge whether they are present or not.

Slave1:
AS1: Address UINT1
LS1: Length of data = DS1[] "can also be 0" UINT1
DS1: Input values to be transmitted "can also be missing" According configured sizes
FCSS1: SubFrame checksum = (AS1 + LS1 + DS1[]) mod 256 UINT1
Slaven:
ASn: Address UINT1
LSn: Length of data = DSn[] "can also be 0" UINT1
DSn: Input values to be transmitted "can also be missing" According configured sizes
FCSSn: SubFrame checksum = (ASn + LSn + DSn[]) mod 256 UINT1
e.g.:           Frame from 2 slaves with input data, having address 1 (2 float variables) and 2 (1 float variable):
0x01 | 0x08 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x09 | 0x02 | 0x04 | 0x43 | 0x7F | 0x00 | 0x00 | 0xC8
Frame from 2 slaves with no input data, having address 1 and 2:
0x01 | 0x00 | 0x01 | 0x02 | 0x00 | 0x02
 

9. Tasks

 

9.1 Initiate Config Mode and Scan Slaves (GetLiveList)

This communication sequence makes it possible, to set all e.- and Q.series slaves to a fixed baud rate and char format (115200/8e1) where configuration tasks can be performed independently from their set data transfer bus parameters. It is also used to detect the slaves on an RS485 port.

First stop other communications to the connected slaves, clear input buffers if necessary, and set the RS485 communication parameters to 115200/8e1.

The following sequence will perform a broadcast to all slaves. From this time, the slaves are communicating with 115200/8e1 and answering immediately with their identification response.

 

9.1.1 Timing

Break tIdle REQUEST-FRAME tResDel RESPONSE-FRAME1 tGap RESPONSE-FRAME2 tGap RESPONSE-FRAMEn
 
Break* =             Send Break for 1024 Bit times (8.8ms@115200)
tIdle = 2.5ms
tResDel = ~1 char
tGap = 1 char
 

9.1.2 Break

A serial break is not a character. It is a signal that can be sent using the TX line of the device sending the break.

When a serial port is idle and no data is being sent the TX line is in a logical 1 state. While data is being sent the TX line rapidly transitions between logical 0 and logical 1. Each frame of data takes a certain period of time to send, depending on the bit rate of the connection. This is called the “frame time” or “word time”.

A break occurs when the TX line is held to a logical 0 for longer than one frame time (between 8 - 16 ms → so ~10 ms would be a good value)

 

9.1.3 Request-Frame

GetLiveList request frame takes only one UINT1:

Cmd:            Command                                                        UINT1
0x00: switch to configuration mode (115200/8e1)
0x02: switch to setted bus parameters (from interface configuration)
 

9.1.4 Response-Frame

⇒ refer to “Slave Scan” response.
It is important to expect the maximum number of possible slaves on a UART so the minimum time to receive data can be calculated as follows:

32 (Slaves) * 11 (chars per Slave) * ~96 (time per char in µs) *  1.1 (10% reserves) = ~38ms

9.2 Read file sequence

9.2.1 Flowchart

  • <OpenReadFlash>
  • Repeat loop <GetDiag> until answer present (max. 20s / 100ms poll interval)
  • <ReadFlash> at least CheckSum- and Length-Section
  • <ReadFlash> remaining data
  • Store file data after checking all rules
  • <CloseFlash>
  • Repeat loop <GetDiag> until answer present (max. 20s / 100ms poll interval)
 

9.2.2 Example

Reading a _c.gcf file from a slave with address 1

<OpenReadFlash>
W: A6 01 02 03 01 07
R: E5

<GetDiag> - immediate response, so proceed without further looping ...
W: A6 01 01 02 04
R: B6 01 06 00 00 00 00 00 00 07

<ReadFlash> CheckSum- and Length-Section
W: A6 01 04 05
00 00 ... Offset in file
0A ... Amount of data to read
14
R: B6 01 0A
00 8C ... CheckSum of Length-Section
07 F0 ... CheckSum of Header-Section
FF E7 ... CheckSum of FileData-Section
00 1E ... Length of Header-Section
09 65 ... Length of FileData-Section
00

<ReadFlash> remaining data
W: A6 01 04 05
00 0A ... Offset in file
1E ... Amount of data to read
32
R: B6 01 1E
0E ... Length of DateTime
32 30 31 33 31 31 32 35 31 36 32 30 34 30 ... DateTime
0E ... Length of Name
69 73 6D 62 75 73 33 32 5F 63 2E 67 63 66 ... Name
0F

<ReadFlash> remaining data
W: A6 01 04 05
00 28 ... Offset in file
80 ... Amount of data to read
B2
R: B6 01 80
5B 44 45 56 49 43 45 5D 0D 0A 4D 6F 64 54 79 3D ... FileData
31 30 0D 0A 53 4D 6F 64 54 79 3D 32 0D 0A 46 75 ... FileData
54 79 3D 36 33 38 31 39 32 31 0D 0A 43 61 54 79 ... FileData
3D 32 0D 0A 44 61 74 65 3D 32 30 31 32 30 34 32 ... FileData
33 30 37 35 32 30 30 0D 0A 55 73 3D 55 73 65 72 ... FileData
0D 0A 55 73 44 61 3D 0D 0A 4C 6F 63 3D 55 6E 64 ... FileData
65 66 0D 0A 53 52 61 74 65 3D 31 30 0D 0A 56 43 ... FileData
6E 74 3D 32 0D 0A 0D 0A 5B 53 50 45 43 49 41 4C ... FileData
1F

<ReadFlash> remaining data
W: A6 01 04 05
00 A8 ... Offset in file
80 ... Amount of data to read
32
R: B6 01 80
44 41 54 41 5D 0D 0A 42 6C 30 3D 30 30 30 30 30 ... FileData
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 ... FileData
30 30 30 30 30 30 30 30 30 30 30 0D 0A 42 6C 31 ... FileData
3D 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 ... FileData
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 ... FileData
30 0D 0A 42 6C 32 3D 30 30 30 30 30 30 30 30 30 ... FileData
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 ... FileData
30 30 30 30 30 30 30 0D 0A 42 6C 33 3D 30 30 30 ... FileData
56

...

<ReadFlash> remaining data
W: A6 01 04 05
09 28 ... Offset in file
65 ... Amount of data to read
A0
R: B6 01 65
0D 0A 43 4A 54 65 6D 70 3D 30 0D 0A 43 4A 56 49 ... FileData
6E 64 3D 30 0D 0A 4D 69 6E 58 3D 2D 32 30 0D 0A ... FileData
4D 61 78 58 3D 32 30 0D 0A 4D 69 6E 59 3D 2D 32 ... FileData
30 0D 0A 4D 61 78 59 3D 32 30 0D 0A 4C 50 43 6E ... FileData
74 3D 32 0D 0A 58 30 3D 2D 32 30 0D 0A 59 30 3D ... FileData
2D 32 30 0D 0A 58 31 3D 32 30 0D 0A 59 31 3D 32 ... FileData
30 0D 0A 0D 0A ... FileData
82

<CloseFlash>
W: A6 01 01 07 09
R: E5

<GetDiag> - immediate response, so proceed without further looping ...
W: A6 01 01 02 04
R: B6 01 06 00 00 00 00 00 00 07

9.3 Write file sequence

 

9.3.1 Flowchart

  • Prepare all sections and put all data together
  • <SetExecState> stop
  • <OpenWriteFlash>
  • Repeat loop <GetDiag> until answer present (max. 20s / 100ms poll interval)
  • <WriteFlash> all data
  • <CloseFlash>
  • Repeat loop <GetDiag> until answer present (max. 20s / 100ms poll interval)
  • <SetExecState> Start with actual bus parameters - if more than one file needs to be written into the same slave, this can be done after the last one

9.3.2 Example

Writing a _c.gcf file to a slave with address 1

<SetExecState> stop
W: A6 01 02 0E 00 11
R: E5

<OpenWriteFlash>
W: A6 01 02 04 01 08
R: E5

<GetDiag> - no response, one more loop ...
W: A6 01 01 02 04
R: TIMED OUT

<GetDiag> - no response, one more loop ...
W: A6 01 01 02 04
R: TIMED OUT

...

<GetDiag> - immediate response, so proceed without further looping ...
W: A6 01 01 02 04
R: B6 01 04 00 00 00 00 05

<WriteFlash> remaining data
W: A6 01 84 06
00 00 ... Offset in file
80 ... Amount of data to write
00 58 07 F4 D8 09 00 1E 03 37 0E 32 30 31 33 31 ... FileData
31 32 35 31 37 32 36 31 30 0E 69 73 6D 62 75 73 ... FileData
33 32 5F 63 2E 67 63 66 5B 44 45 56 49 43 45 5D ... FileData
0D 0A 4D 6F 64 54 79 3D 32 31 31 0D 0A 53 4D 6F ... FileData
64 54 79 3D 30 0D 0A 46 75 54 79 3D 30 0D 0A 43 ... FileData
61 54 79 3D 30 0D 0A 44 61 74 65 3D 32 30 31 33 ... FileData
31 31 32 35 31 37 32 35 30 30 0D 0A 55 73 3D 55 ... FileData
73 65 72 0D 0A 55 73 44 61 3D 0D 0A 4C 6F 63 3D ... FileData
0B
R: E5

<WriteFlash> remaining data
W: A6 01 84 06
00 80 ... Offset in file
80 ... Amount of data to write
48 4A 54 0D 0A 41 64 64 50 72 6F 70 3D 30 0D 0A ... FileData
53 52 61 74 65 3D 30 0D 0A 56 43 6E 74 3D 32 0D ... FileData
0A 0D 0A 5B 53 50 45 43 49 41 4C 44 41 54 41 5D ... FileData
0D 0A 42 6C 30 3D 30 30 30 30 30 30 30 30 30 30 ... FileData
30 30 30 30 30 30 0D 0A 42 6C 31 3D 30 30 30 30 ... FileData
30 30 30 30 30 30 30 30 30 30 30 30 0D 0A 42 6C ... FileData
32 3D 30 30 30 30 30 30 30 30 30 30 30 30 30 30 ... FileData
30 30 0D 0A 42 6C 33 3D 30 30 30 30 30 30 30 30 ... FileData
52
R: E5

...

<WriteFlash> remaining data
W: A6 01 63 06
03 00 ... Offset in file
5F ... Amount of data to write
0A 4D 69 6E 56 61 6C 4F 75 74 3D 30 0D 0A 4D 61 ... FileData
78 56 61 6C 4F 75 74 3D 32 45 2D 32 0D 0A 53 74 ... FileData
56 61 6C 3D 30 0D 0A 55 66 6C 6F 77 3D 30 0D 0A ... FileData
4F 66 6C 6F 77 3D 32 2E 32 45 2D 32 0D 0A 57 61 ... FileData
74 63 68 54 69 6D 6F 4D 6F 3D 30 0D 0A 57 61 74 ... FileData
63 68 54 69 6D 6F 44 65 66 3D 30 0D 0A 0D 0A ... FileData
1E
R: E5

<CloseFlash>
W: A6 01 01 07 09
R: E5

<GetDiag> - immediate response, so proceed without further looping ...
W: A6 01 01 02 04
R: B6 01 04 00 00 00 00 05

<SetExecState> start with actual busparameters
W: A6 01 02 0E 01 12
R: E5