DPM Serial Protocol

Serial communication protocol DPM (Dilbertian Protocol Modified)

Note the protocol nameThe name “Dilbertian” comes from the first version of this protocol, we called “IDP Inverted Dilbertian Protocol” (2010), where zeros were represented with a cell “thin” and with a cell “large” (“0” skinny and “1” fat – the inverse of the following strip from “Dilbert” by Scott Adams – www.dilbert.com).

ENGLISH

Italian

Because a new Protocol ?

Theremino the system aims to provide a simple Input-Output System for PC, cheap and easy to use. To make it easy to use auto-numbering are needed and the recognition of their types, to simplify and minimize the cost of the links is necessary to communicate on a wire only.

There is a similar protocol we had to write it. The current version collects the best of many years of experimentation and research.

Features

Number of bytes transmitted and received varies depending on the type of device.

Transmission speed up to 4 Megabits/sec to transmit a lot of data with short cables.

Transmission speed up to 100 Kilobits/sec for long cables (up to 10 Km).

High efficiency of communication (from 10 to 20 times greater than in CAN).

Electric shutters

The transmission takes place on a single wire, but you need a reference mass and a supply voltage, to where the wires are normally three.

Any device that supports DPM must have an input connector (to the Master) and one output to downstream devices (Slaves)

The connectors are normally used by 3 poli, with spacing of 2.54 mm.

On the communication chain should have a Master (providing power and timing) and a number of devices connected in cascade (called Slave).

The tension that the Master provides on line is 5 V, with the same tolerance and with the same maximum current of 5 V that withdrawing from the USB connector.

The maximum current that the Master can provide limits the number and type of devices that can be connected. This current, is normally 250 mA, and may be increased up to 500 mA. Going over it would exceed the capacity of the USB ’ and would impose unusual features to the connectors.

The maximum number of connectable devices is limited by the following factors:
– The maximum current that the “Master” can provide.
– The maximum number of bytes that the line bears in cycle time of rice-transmission.

Both the “Master” that the “Slave” are connected to the line with a damping resistor, It also acts as a low pass, radio interference and overvoltage protection. The value of this resistor is normally from 33 to 330 ohm resistor

Broadcast format

Levels of data line “Com. Line”

The line aside it to level up (3.3 V)
The signal “1” is denoted by 3.3 V
The signal “0” is denoted by 0 V

Repeat times and throughput

Transmission speedUsing low speeds when the length, and so the capacity of the connection cables, are high. When the distances are short and high speed may be used to communicate with a large number of devices (or communicate with devices that require a large number of bytes) Are established named speeds from “1” (1 k bits/Sec) up to “12” (4 mega bits per second)

Maximum number of bytesDepending on the baud rate the maximum number of bytes that can be transmitted is listed in the following table.

Times, distances and number of bytes

Speed

bit time

bit

for

second

Bytes
every
15mS

Bytes every
30mS

Max distance

Max capacity

Slaves

Max

number

1

1 mS

1K

1

3

10 Km

1 uF

3

2

500 uS

2K

3

6

5 Km

500 nF

6

3

200 uS

5K

4

8

2 Km

200 nF

15

4

100 uS

10K

15

30

1 Km

100 nF

30

5

50 uS

20K

30

60

500 m

50 nF

60

6

20 uS

50K

40

80

200 m

20 nF

150

7

10 uS

100K

150

300

100 m

10 nF

160

8

5 uS

200K

300

600

50 m

5 nF

80

9

2 uS

500K

400

800

20 m

2 nF

32

10

1 uS

1M

1500

3000

10 m

1 nF

16

11

500 NS

2M

3000

6000

5 m

500 pF

8

12

250_nS

4M

6000

12000

2.5 m

250 pF

4

All devices must implement at least the speed “7” that is considered the default speed. If you want to set a different speed from the “7” all devices in the chain must support it.

The “maximum distance” depends on the characteristics of cables, the table values are calculated for a shielded cable RG58 from 50 ohm with ability to 100pF per meter.

At low speeds the number of “slaves” is limited by the maximum number of bytes that can be transmitted in 30 milliseconds. (each slave uses at least one byte and you claim a repeat fast enough to make fluid movements)

At high speed, the number of “slaves” is limited by the maximum capacity, each “slave” Adds a capacity of approximately 40..60 PF and reduces the maximum distance of approximately 50 cm.

The capacity was calculated on the basis of 30pF per “slave” plus other 20pF to a connection cable from 20 cm and other 10pF to take account of the additional resistance due to “bilateral switch” (total: 60pF)

Maximum cable length of communication than the supply current and resistance per meter

Cable type —>

Maximum current

( peak current )

H1500/H1000/H500/H155/RG11

20 Milli ohms

or less

per meter

RG58/RG59U/ H155/

net cables

about

50 Milli ohms

per meter

Rg59/RG6/phone twisted wire/

net cables

about

100 Milli ohms

per meter

10 mA

1 Km

400 m

200 m

20 mA

500 m

200 m

100 m

50 mA

200 m

80 m

40 m

80 mA

125 m

50 m

25 m

100 mA

100 m

40 m

20 m

200 mA

50 m

20 m

10 m

400 mA

25 m

10 m

5 m

500 mA

20 m

8 m

4 m

800 mA

12.5 m

5 m

2.5 m

1 A

10 m

4 m

2 m

In the calculation of the distance we take into account that the voltage drop on the ground, does not exceed 200 MV. The voltage drop on power cable, not causing transmission errors, It can also be much higher (the 5 V can drop down to 3.3 V without creating problems) In case of shielded cables on ground is the screen, which usually has less resistance than declared, so the distance will be greater.

Cable capacity

The values of “maximum length” indicated in the table above are valid only for connecting cable with a capacity of approx. 100 pF per meter. The following table shows the corrections to be applied for the most commonly used cables.

Measure between Central and outer shield with a meter or capacitance meter.

To improve measurement accuracy, use five or ten metres of cable.

Divide the value of Picofarads measured by the number of meters of cable.

Types of devices

The devices are labeled with a number from 0 to 199 identifying her "Type".
At the stage of recognition and numbering each device identifies itself with this "Type".

Currently are defined the following devices:

Device Type

Speed

min

Speed max

In out Pins

Power

Name

0

Special “custom” type

1

1

12

1

12 mA

Capacitive Sensor

Hi Quality

2

1

12

10

Inout Servant

3

1

12

12

Inout Generic

4

1

12

12

INOUT

5

6

Virtual Master Pins
(first version)

8

10

Virtual Master Pins – V2

9

12

Virtual Master Pins – V4

255

Unknown

Maximum number of devicesThe maximum number of connectable devices is limited by:
– the maximum number of bytes that can be transmitted depending on the selected speed.
– the maximum current that the "master" can provide (normally 500 mA)
– the maximum number of devices supported by the Protocol is 200 (from 0 to 199)

Pin Types

The pins are labeled with a number from 0 to 255 identifying her "PinType".

(*1) Service commands.(*2) The command is only used by the master and the slaves Recog during recognition.(*3) Fast communication – the master exchanges the values of all slaves using only one USB Exchange(*4) Communication commands to the single slave(*5) Special commands

SendValuesToSlave sends the values to the Output Pin of a slave (Physical forms on the Master or virtual Slaves)

GetValuesFromSlave reads values from the Input Pin of a slave (Physical forms on the Master or virtual Slaves)

GetBytesFromSlave law generic bytes (for example of State), from a slave (Physical forms on the Master or virtual Slaves)

All commands have codes from 200 to 255, to prevent, in case of errors, IDs and slave types (from 0 to 199) could be interpreted as a command. (Setspeed doesn't count because it is never sent over the serial line but only by HAL, to the Master, via USB)

Communication between Host computer and Master (USB)

Commands from “Host” to “Master”

Command name

ID
USB_TxData[0]

PARAMETERS
USB_TxData[1 to n]

RecogStart

CommandID,

Nbytes

FastDataExchange

CommandID,

From 0 to 60 data bytes

SetupSlavePins

CommandID,

SlaveId, Nbytes

SetMasterName

CommandID,

MasterName (zero terminated)

GetMasterName

CommandID,

–

SendValuesToSlave

CommandID,

SlaveId, Nbytes, Byte1….ByteN

GetValuesFromSlave

CommandID,

SlaveId, Nbytes

SendBytesToSlave

CommandID,

SlaveId, Nbytes, Byte1….ByteN

GetBytesFromSlave

CommandID,

SlaveId, Nbytes

SetSpeed

CommandID,

CommSpeed

Responses from “Master” to “Host”

Command name

RESPONSE
USB_RxData[0]

RETURN VALUES
USB_RxData[1 to n]

RecogStart

0 = OK

Nslaves, Slave Type1 … Slave Type N

FastDataExchange

0 = OK

From 0 to 63 data bytes

SetupSlavePins

0 = OK

–

SetMasterName

0 = OK

–

GetMasterName

0 = OK

Master Name (zero terminated)

SendValuesToSlave

0 = OK

–

GetValuesFromSlave

0 = OK

Bytes 1 … Byte N

SendBytesToSlave

0 = OK

–

GetBytesFromSlave

0 = OK

Bytes 1 … Byte N

SetSpeed

0 = OK

–

The zero position of the USB Buffer indicates whether the command was executed from “Master” successfully.

Calculation of the CRC

All CRC used are calculated over a certain number of consecutive bytes and the CRC result is a byte. CRC calculation using an algorithm based on "Longitudinal redundancy check".

Setting the baud rate

If you decide to use a baud rate other than the default one, then the "master" should communicate to all devices in the chain the new speed.

This setting should be possible even before making a loop device recognition and must be also possible with very long transmission lines. Therefore there is a special command that is now shown.

1 – The Master maintains the high line for 50 mS
2 – All the slaves are definitely placed pending one character
3 – The Master generates a BREAK (low level line 12 bit at minimum speed
4 – The Master issues a 55 character (01010101) the desired baud rate
5 – All slaves infer the baud rate from this bytes (Auto-baud)
6 – The Master sends one byte that specifies the "Speed" (from 1 to 12)
7 – The Master sends one byte of CRC calculated on two bytes (cmd/speed)
8 – If the Slave is a mistake does not change its speed

Check the baud rate

If you set a speed too high for transmission line in use some devices in the chain may not be able to support the speed setting and errors can occur when transmitting data.

If transmission errors are zero or less than the 0.1% then the speed set is valid.

Recognition and numbering

1 – The Master outputs to the Slave the whole sequence of "Speed" setting to ensure that all communicate at the same speed.
2 – The Master does not transmit commands to 50 milliseconds.
3 – At this point all slaves should be waiting for a command.
4 – The Master issues a code "254″ (RecogStart).
5 – All the slaves they put the weak-pull-up (100-400 UA) on the input-output and open the output connection to downstream devices. They no longer respond to any commands except "253″ (Recog).
6 – Il Master” emette un codice “253″ (type request) and then a byte with the number 0″, the first device in the chain meets a byte with its type, Removes the pull-up, connect to the downstream Slave and not responding to any commands.
7 – Il Master emette un codice “253″ (type request) and then a byte with the number 1″, the second device in the chain meets a byte with its type, Removes the pull-up, connect to the downstream Slave and not responding to any commands.
8 – Il Master emette un codice “253″ (type request) and then a byte with the number "2″,

…. the “253” (type request) repeats up to 200 timesWhen no longer responds to a duration greater than 10 bit at current throughput, means that the chain is over. To avoid this calculation, You can use a time-out of 12 Ms that always works, even at the lowest speed.

9 – The Master issues toward the slaves all setting sequence "Speed", that shows all the slaves in the normal communication mode.
10 – The Master informs the Host (PC) via USB Slave recognized number and type of each.

Donations

Our applications have no copyright, so you can make every use, without any limitation. We are not asking even for the name Theremino or the site, but remember to us and let us know your friends.

Any donations, even small, are very welcome and can help the next projects.

Get the system modules

The theremino team only deals with research and does not sell hardware.

The system is completely "Freeware", "Open Source", "Not for Profit" and "DIY", but there are manufacturers who can provide modules assembled and tested at a great price. One could hardly self-build them spending less.

Disclaimer

The software, the firmware and circuit diagrams published on this site,
should not be used for life support systems,
or in any project where failure can affect the safety.

This does not mean that the system is particularly unreliable. Indeed, precisely because of its smooth functioning, could someone use it inappropriately.
But theremino the system was not designed for applications that can be dangerous, for which we disclaim all responsibility.

Legal notice

This site does not capture and store personal information.

Even in the case of donations through PayPal, We do not collect user's details.

Everything on the site is completely free, Open Source and no copyright.

For the license, legal notices and the privacy of personal data, consult This page.