Setting and Detecting a "Break" State

<< Click to Display Table of Contents >>

Navigation:  Working with Docklight (Advanced) >

Setting and Detecting a "Break" State

Some serial application protocols (e.g. LIN) make use of the so-called Break state for synchronization purposes.  Docklight Scripting supports sending a "break" within a Send Sequence  and detecting a "break" state using a Receive Sequence definition. "break" signals are added to your sequence definition by inserting a Function Character '%' (F10 key). A Docklight "break" signal has a minimum length of 15 * <nominal bit length>.

 

Preconditions

 

Docklight is ready to run a test as described in testing a serial device or a protocol implementation.

The Docklight project already contains one or several Send Sequences, but signalling or detecting a "break" state is also required.

 

Sending a "Break" state

 

We assume there is already a "Test" Send Sequence which looks like this in ASCII mode:

T | e | s | t

 

1.Open the Edit Send Sequence dialog.
2.Insert a "Break" function character at the beginning: Press F10, or open the context menu using the right mouse button, and choose Function character '%' (break signal) . The example sequence now reads:  

% | T | e | s | t

3.Click OK to confirm the changes
4.Send the test sequence using the Pt_Send_Button Send button.

 

The TX line will go to Space (logical 0) for at least 15 bit durations, then the "Test" ASCII sequence will be transmitted. The "break" character does not appear in the communication window display.

 

 

Detecting a "Break" state

 

Received "break" signals are not displayed in the communication window, because they are not part of the actual data sequence. Nonetheless, it is possible to define a Receive Sequence including a "break" function character.

 

1.Create a new Receive Sequence. Enter a Name for the sequence.
2.Add a Function character '%' (break signal) for the Sequence data.
3.Enter a Receive Sequence Action, for example printing the comment "BREAK detected"
4.Click OK to confirm the changes
5.Start communications.

 

Docklight will now add BREAK detected to the communication window display each time a break signal is detected.

 

NOTE: After detecting a break signal, an additional <NUL> character (decimal code 0) may appear in the received data stream. This behavior cannot be controlled by Docklight, it depends on how the serial UART of your PC's COM port interpretes the break state.

 

NOTE: If you need to implement a Receive Sequence that checks for a break signal followed by additional data, keep in mind that Docklight cannot tell the exact position of the break signal within the data stream. The break signal will sometimes show up earlier in the data stream, but never later than the actual position. To define a Receive Sequence that safely triggers on break + specific data, you can use the following workaround: Insert some '#' (zero or one character) wildcards between the break character and the additional data. The resulting Receive Sequence could look like this:

% | # | # | # | # | # | # | # | # | T | e | s | t