23.03.2014 Views

Presentation - KNX

Presentation - KNX

Presentation - KNX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Tutor crash course<br />

Part 5: <strong>KNX</strong> Protocol


<strong>KNX</strong> Protocol: hierarchical classification of bus systems<br />

• Field level<br />

• Sensor/actuator level<br />

• Small data throughput – time<br />

critical<br />

• Typical <strong>KNX</strong><br />

• Process level<br />

• Centralised devices monitoring<br />

sensors and controlling actuators<br />

(e.g. building management<br />

station)<br />

• Operation level<br />

• Centralised computer monitoring<br />

devices at process level<br />

• Large data throughput – not so<br />

time critical<br />

System bus<br />

e.g. Ethernet<br />

Operation<br />

Main<br />

Computer<br />

Process<br />

Process<br />

computer/<br />

Control<br />

Center<br />

Process<br />

computer/<br />

Control<br />

Center<br />

Field<br />

Bus<br />

device<br />

Bus<br />

device<br />

Bus<br />

device<br />

Bus<br />

device<br />

Field bus (e.g. Profibus)<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 2<br />

August 12


<strong>KNX</strong> Protocol: classification of serial bus systems<br />

• Frequency Division<br />

Multiplexing<br />

• More than one device<br />

can access the bus at<br />

one given instance<br />

• Time Division<br />

Multiplexing<br />

• One single device<br />

accesses the bus at<br />

one given instance<br />

- <strong>KNX</strong> TP1 = Carrier<br />

Sense Multiple<br />

Access with<br />

Collision Avoidance<br />

Serial<br />

busses<br />

Frequency Division Multiplexing<br />

(FDM)<br />

One bus device per pair of channels<br />

(bidirectional)<br />

Several bus devices per pair of channels<br />

(need for similar bus access methods as<br />

TDM)<br />

Time Division Multiplexing (TDM)<br />

Controlled bus access<br />

Centralized bus allocation<br />

(Master/Slave)<br />

Decentralized bus allocation (Token<br />

passing, Flying master)<br />

Random bus access<br />

CSMA/CD<br />

CSMA/CA<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 3<br />

August 12


<strong>KNX</strong> Protocol: OSI - Principles<br />

• OSI = Open Systems Interconnection<br />

• Is a standard for modelling/structuring distributed<br />

communication systems<br />

• Does not dictate the development method<br />

• All layers in the device contribute to a part of the sent message<br />

– each layer in the device decodes part of a received message -<br />

similar to peeling layers off an onion<br />

• model consists of seven layers, of which some are not used in<br />

<strong>KNX</strong><br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 4<br />

August 12


<strong>KNX</strong> Protocol: types of communication<br />

• Connection oriented<br />

communication<br />

• communication between a maximum<br />

of two devices (point-to-point)<br />

• highly secure communication, not<br />

very bandwidth effective<br />

• Link and Transport Layer<br />

acknowledgements will be visible<br />

• in <strong>KNX</strong>: typically during<br />

configuration of devices (between<br />

ETS and device)<br />

• similar to talking to one single<br />

person and checking after each<br />

question whether he/she understood<br />

the question<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 5<br />

August 12


<strong>KNX</strong> Protocol: types of communication<br />

• Connectionless communication<br />

• communication one to many<br />

(« group or multicast ») or one to all<br />

(« broadcast »)<br />

• very bandwidth effective, not<br />

secure communication (one<br />

common confirmation of reception to<br />

the sent message)<br />

• only Link Layer acknowledgements<br />

will be visible on the bus<br />

• in <strong>KNX</strong> typically after configuration of<br />

devices, i.e. during runtime<br />

• similar to talking to a group of<br />

persons and continuing with next<br />

question if only one person confirms<br />

that he/she understood the question<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 6<br />

August 12


OSI & <strong>KNX</strong> (top down) – Application Layer<br />

• provides mechanisms for communication (group) objects. The<br />

application layer ensures that<br />

• an application program is informed when the value in one of its<br />

communication objects was updated (received telegram) or<br />

• that the OSI <strong>KNX</strong> stack creates a telegram when a value of a<br />

communication object updated by the application program (sent<br />

telegrams)<br />

• In other words : when connected to the application layer, the application<br />

program is unable to retrieve who was the source of the update!!!<br />

• provides mechanisms for management purposes. These services<br />

- as part of the OSI <strong>KNX</strong> stack - ensure that devices understand<br />

configuration commands, e.g. sent by ETS (MemoryRead,<br />

MemoryWrite, ….).<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 7<br />

August 12


OSI & <strong>KNX</strong> : <strong>Presentation</strong> and Session Layer<br />

• (<strong>Presentation</strong> Layer)<br />

• ensures that information is always presented to the application<br />

layer (received telegrams) or transport layer (sending telegrams)<br />

in the right order<br />

• Not needed/available in the OSI <strong>KNX</strong> stack<br />

• (Session Layer)<br />

• ensures that communication can be interrupted for a certain<br />

period of time and resumed (at the point where one interrupted it)<br />

at a later stage<br />

• Not needed/available in the OSI <strong>KNX</strong> stack<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 8<br />

August 12


OSI & <strong>KNX</strong>: Transport Layer connection oriented<br />

• transport layer messages will be visible next to Link Layer<br />

messages - sequence of events<br />

• opening a connection from device A (USB linked to ETS) to<br />

device B (device to be downloaded) : T_Connect<br />

• sending telegram for A to B or vice versa<br />

- A and B send T_Ack when properly received<br />

- A and B send T_Nack when not properly received - will cause a<br />

repetition (maximum 3 times)<br />

- a sequence number is incremented after each data exchange<br />

• closing a connection from device A to B : T_Disconnect - also<br />

automatically when communication partner did not react within 6<br />

seconds<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 9<br />

August 12


TL Connection Oriented<br />

Pos<br />

Sender<br />

TL Connect 1.1.1 to 1.1.2<br />

Message Seq. No. 0<br />

Receiver<br />

TL Ack Message Seq. No. 0<br />

TL Disconnect 1.1.1 to 1.1.2<br />

1.1.1 (ETS)<br />

1.1.2<br />

(Device to be programmed)<br />

Neg<br />

Sender<br />

TL Connect 1.1.1 to 1.1.2<br />

Message Seq. No. 0<br />

Receiver<br />

TL Nack Message Seq. No. 0<br />

Rep Message Seq. No. 0 (max 3)<br />

1.1.1 (ETS)<br />

TL Disconnect 1.1.1 to 1.1.2<br />

1.1.2<br />

(Device to be programmed)<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 10<br />

August 12


TL Connection Oriented<br />

No<br />

Sender<br />

TL Connect 1.1.1 to 1.1.2<br />

Receiver<br />

Message Seq. No. 0<br />

…<br />

Rep Message Seq. No. 0 (max 3)<br />

1.1.1 (ETS)<br />

TL Disconnect 1.1.1 to 1.1.2<br />

1.1.2<br />

(Device to be programmed)<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 11<br />

August 12


OSI & <strong>KNX</strong>: TL connectionless – Network Layer<br />

• Transport Layer connectionless<br />

• (when sending) transport layer ensures that the value of the changed<br />

communication object is sent by the Link Layer with the correct<br />

associated (sending) group address<br />

• (when receiving) transport layer ensures that the value of all<br />

communication objects is updated, to which the received group<br />

address is linked.<br />

• Network Layer (NL)<br />

• Ensures that each sent message contains the routing counter value<br />

as set in EEPROM (in case of BCU1, 10Eh)<br />

• Routing counter value will be decremented when passing through<br />

line/backbone coupler<br />

• Can be 0 (no routing), 1 – 6 (normal routing and decrementing, to be<br />

used by normal applications), 7 (route and do not decrement, to be used<br />

by e.g. ETS)<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 12<br />

August 12


OSI & <strong>KNX</strong>:TP1 Link Layer – error detection techniques<br />

Telegram example: BC 1041 17D0 E1 00 81 xx<br />

• Per character (= 8 bits)<br />

• One start bit before the character<br />

• One stop bit after the character<br />

• One parity bit after the character<br />

• = Vertical parity check<br />

• After all sent bytes<br />

• Checksum Byte : adding all sent bytes and Exor-ing the result – actual value<br />

not shown in above telegram example<br />

• = Horizontal parity check<br />

• Combination of vertical and horizontal parity check = cross<br />

check<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 13<br />

August 12


Cross check in <strong>KNX</strong> TP1<br />

Horizontal Parity<br />

Vertical Parity<br />

Character<br />

Checksum<br />

Start<br />

Stop<br />

Parity<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 14<br />

August 12


Bus access and collision<br />

Request to device to<br />

send 1<br />

Signal shape Bit coding “0”<br />

Listen to bus<br />

No and<br />

wait<br />

Signal shape Bit coding “1”<br />

Bus available ?<br />

yes<br />

Send 1 on bus<br />

Continue with next<br />

bit (if any)<br />

no<br />

Collision (= hearing 0)<br />

yes<br />

Interrupt and set<br />

repetition bit to 0<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 15<br />

August 12


OSI & <strong>KNX</strong>:TP1 Link Layer Control field<br />

Telegram example: BC 1041 17D0 E1 00 81<br />

• Note : all characters are sent on the bus from right to left !<br />

• Control Field (8 bit)<br />

• Structure:<br />

D7 D6 D5 D4 D3 D2 D1 D0<br />

1 0 R 1 P P 0 0<br />

• Bit D0 and D1 : preamble bits, set to value 0 (double active bit, avoids that only one spike is<br />

interpreted as the start of a telegram)<br />

• Bit D2 and D3 : priority (P)<br />

value is determined by the setting in ETS for each communication object – parameter from<br />

AL to LL<br />

Coding selected to allow collision avoidance : Zero value overrides the 1 - in case of two<br />

simultaneous sending devices, the one sending a 1 but hearing a 0 will stop transmission<br />

Possible codings: 00b (system) – 10b (alarm) – 01b (High) – 11b (Low)<br />

• Bit D5 : repetition R<br />

- 1 : not repeated telegram<br />

- 0 : repeated telegram<br />

• Other bits (D4, D6, D7) : set to particular fixed value (i.e. if not this value, invalid LL telegram,<br />

not accepted by LL !)<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 16<br />

August 12


OSI & <strong>KNX</strong>: Link Layer (LL) acknowledgement<br />

LL Acknowledgement: 1 single byte XXh<br />

• If coding CCh = Positive Acknowledgement (LL ACK)<br />

• Confirmation of reception of a LL telegram addressed to a device<br />

• Confirmation that :<br />

- The received telegram was received without any errors and<br />

- The device indeed had the individual address contained as destination address<br />

in the received telegram or<br />

- The device indeed listens to the group address contained as destination address<br />

in the received telegram<br />

• Confirmation is sent simultaneous by all addressed devices – sender only sees one confirmation<br />

– if one device out of a group does not send LL Ack, sender can not detect this!<br />

• If coding = 0Ch Negative Acknowledgement (LL NACK)<br />

• Confirmation that the received telegram was received with errors<br />

• If coding = C0h LL Busy<br />

• Confirmation that the received telegram could not be processed as LL – buffers full<br />

• Owing to chosen coding, in the case of simultaneous sending of ACK and Nack (or Busy), Nack or<br />

Busy overrule ACK – in that case, sender retransmits with repetition flag set (devices having already<br />

processed previous non-repeated telegram, disregard repeated telegrams)<br />

• Across lines, line/backbone couplers take over the Acknowledgement of telegrams<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 17<br />

August 12


Repetition Flag<br />

Sender<br />

GA x<br />

GrpValueWrite Grp x, R=1, Value 1<br />

“GrpValueWrite” Grp x, R=0, Value 1<br />

Receiver 1<br />

GA x<br />

Receiver 2<br />

Ack<br />

GA x<br />

Ack<br />

Receiver n<br />

GA x<br />

Nack<br />

Ack<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 18<br />

August 12


OSI & <strong>KNX</strong>:TP1 Link Layer – further fields<br />

Telegram example: BC 1041 17D0 E1 00 81 xx<br />

• Sender address (format see next slide)<br />

• Individual address of the sending device<br />

• Zero value overrides 1 – in case of two simultaneous sending devices, the one<br />

sending a 1 but hearing a 0 will stop transmission (i.e. at the latest when sending<br />

its individual address, which should be unique).<br />

• Destination address (format see next slide)<br />

– Can be a group address or an individual address<br />

– Depends on the first bit in the byte following the destination address<br />

– When group address = 0/0 then broadcast telegram (message to all devices in the<br />

network)<br />

• N_PDU (Network Protocol Data Unit)<br />

– See later (slide 54)<br />

• Check byte<br />

– See before (slide 45)<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 19<br />

August 12


Format Individual and Group Address<br />

Individual Address (16 bit) = can be sender or destination address<br />

D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0<br />

Area<br />

Line<br />

Device address<br />

If value is 0 backbone<br />

If value is 0 main line<br />

If value is 0 coupler<br />

If value is 1 to 15 area<br />

If value is 1 to 15 line<br />

If value is between 1 to 64 first line segment<br />

If above 64: line extension, other line segment<br />

2 level “M/S”<br />

3 level “M/m/S”<br />

Group Address (16 bit) = can only be destination<br />

address<br />

D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 D7<br />

Main Group Subgroup T<br />

Main Group Middle Group Sub Group<br />

Next byte<br />

Most significant bit T= type<br />

…<br />

Most significant bit not used in two level/three level group address structure (only when having<br />

set free address structure in ETS 4)<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 20<br />

August 12


Decoding of <strong>KNX</strong> Telegrams:<br />

summary flowchart (1)<br />

Control field<br />

1 byte<br />

Format see slide 48<br />

Sender<br />

Address<br />

2 bytes<br />

Format individual address<br />

see slide 52<br />

Destination<br />

Address<br />

2 bytes<br />

Individual or group ? see first bit<br />

next byte<br />

Format individual or group address<br />

see slide 52<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 21<br />

August 12


Decoding of <strong>KNX</strong> Telegrams:<br />

summary flowchart (2)<br />

Address Type<br />

1 bit<br />

Group = 1 – Individual = 0<br />

Routing<br />

counter<br />

3 bits<br />

Value of routing counter 0 to 7<br />

Payload length<br />

4 bits<br />

Length of the useful data<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 22<br />

August 12


Decoding of <strong>KNX</strong> Telegrams:<br />

summary flowchart (3)<br />

Type of TL<br />

communication<br />

2 bit<br />

UDP = Unnumbered Data Packet<br />

NDP = Numbered Data Packet<br />

UCB = Unnumbered Control Data<br />

NCD = Numbered Control Data<br />

00b UDP 01b NDP 10b UCD<br />

11b NCD<br />

4 bit<br />

always 0<br />

4 bit<br />

Seq. No<br />

4 bit<br />

always 0<br />

4 bit<br />

Seq. No<br />

4 bit 4 bit<br />

2 bit<br />

2 bit<br />

APCI + rest : see<br />

Manual P 28 till<br />

end of chapter<br />

APCI + rest : see<br />

Manual P 28 till<br />

end of chapter<br />

00b = TL Connect<br />

01b = TL<br />

Disconnect<br />

10b = TL Ack<br />

11b = TL Nack<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 23<br />

August 12


OSI & <strong>KNX</strong>: examples of APCIs<br />

• Group Value Read, Value Write, Value Response respectively used to<br />

• read the value of a communication object linked to a particular group address<br />

• write the value of a communication object linked to a particular group address<br />

• reply to a read request with the value of the communication object linked to the group<br />

address used in the read request (in BCU1 = value write for receiver !!)<br />

• are only visible telegram types in a running and configured <strong>KNX</strong> installation<br />

• Memory Write<br />

• write up to 12 byte in the memory of a bus device starting from the indicated memory<br />

address<br />

• Individual Address Write<br />

• writes the indicated individual address into the device in programming mode<br />

• Authorize Request<br />

• used in BCU2/BIM M112 devices, for which one must be authorized to be able to<br />

write memory<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 24<br />

August 12


OSI & <strong>KNX</strong>: TP1 Physical Layer<br />

• Is responsible for the decoding of bits (as generated normally by a<br />

micro-controller) into physical signals on the medium, to which<br />

the bus device is connected<br />

• In principle PhL can be exchanged without affecting the upper<br />

layers<br />

• Physical Layer also specifies e.g. cable distances, cable<br />

characteristics, ….<br />

• Two types of TP1 cable exists : green (standardised – distances<br />

of PhL ensured) – not green (non-standardised – distances of PhL<br />

not ensured)<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 25<br />

August 12


Summary <strong>KNX</strong> Stack<br />

Note: no Session or<br />

<strong>Presentation</strong> Layer in <strong>KNX</strong><br />

Application<br />

Application Layer<br />

Transport Layer<br />

Grp Objects/Configuration<br />

Management<br />

Conless: AssocTable<br />

ConOr: TL (Dis)Connect/<br />

TL (N)Ack<br />

Network Layer<br />

Link Layer<br />

Physical Layer<br />

Routing<br />

Error Detection<br />

@ Table<br />

CSMA/CA<br />

Digital Analogue<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 26<br />

August 12


OSI & <strong>KNX</strong>: Practical Exercises (1)<br />

Decode the control field in the underneath telegram<br />

(1) 90 1041 17D0 E2 00 80 42<br />

Is the underneath telegram a valid frame?<br />

(2) 24 1041 0001 E1 00 80<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 27<br />

August 12


OSI & <strong>KNX</strong>: Practical Exercises (2)<br />

Decode the destination address in the underneath telegram<br />

(3) BC 1041 50F4 E4 00 80 1C 0C 01<br />

What type of telegram is this?<br />

(4) CC<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 28<br />

August 12


OSI & <strong>KNX</strong>: Practical Exercises (3)<br />

What value does the routing counter have in the underneath frame?<br />

(5) BC 1041 17D0 B3 00 80 05 78<br />

What is the significance of the bytes after the destination address?<br />

(6) 94 1041 1234 30 FF<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 29<br />

August 12


OSI & <strong>KNX</strong>: Practical Exercises (4)<br />

What is the significance of the bytes after the destination address?<br />

(7) B4 1041 1234 51 43 00<br />

What is the significance of the bytes after the destination address?<br />

(8) BC 1041 38CA BF 00 40 49 27 6D 20 6B 6E 61 63 6B 65<br />

72 65 64 00<br />

<strong>KNX</strong> Association International <strong>KNX</strong>: The worldwide STANDARD for Home & Building Control<br />

Page No. 30<br />

August 12


Thank you for your<br />

attention and good luck at<br />

the exam!!

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!