Optimot, consultes lingüístiques

enHome tachometerHDHD-tacho-part3

Digital Tachometer for Harley Davidson Sportster (Part 3 - Harley Davidson and SAE J1850 VPW)

Part1 / Part2 / Part3 / Part4 / Part5 / Part6 / Part7 / Part8 / Part9 / Part10 / Part11 / Part12 / Part13 / Part14 / Part15

The best and shortest way to understand this protocol is to read this document. The longest way is to read directly the SAE J1850 documentation. Nevertheless, in this post I will try to summarize the most relevant concepts of this protocol in order to be able to write the proper code to receive and interpret the ECM messages.

According to the standard SAE J1850 VPW, in our bike we will have 1-wire data bus where the information will be broadcasted based on different voltage levels and tranmission timings. These levels are:

  • Passive: 0 - 3,5V (natural state of the data bus)
  • Active: 4,25V - 20V (control units can activate the bus through transistors)

    Main bus properties are:
  • Serial bus: information is sent bit by bit.
  • Asynchronous: broadcasted information between nodes is managed by the same emitter instead of beeing synchronized by another clock signal.
  • Master-less: there is no node with superiority over the others.
  • Peer to peer: All nodes have same capability to transmit.

    One important property of the nodes is that when one is transmitting to the data bus, it listens to itself to check if what it says is the same that is in the data bus. In following lines we will understand why.


In this kind of buses everybody will be able to transmit, for this reason it is necessary to set specific rules in order to not have chaos. It can be mainly summarized in 2 rules:

1- The node who wants to transmit first listens to the bus.
a) If bus is empty during a certain period of time (nobody is transmitting), then this node is allowed to start the transmission.
b) If someone is already transmitting, then it will wait for the transmission to finish and an additionally specified time before it is allowed to start its own transmission.
2- Once it is transmitting the message, in case the bit transmitted is not the same as the bit it reads from the bus, automatically it has to stop the transmission because it lost arbitrariety. This means that other node is also transmitting a message with higher priority.

Source: Momex.cat

And how is this message priority defined?

Everything is managed by voltage levels. As said before, the bus is passive in natural status and therefore the nodes only have activate o deactivate the transistor in order to change the bus to active or passive mode. If one node is transmitting a passive bit but it reads an active bus, this means that some other node is transmitting at the same time.

And then?

Everything lays in the 3 bytes in the message header. There, one of these bytes shows the message priority stablished by the engineer who decided which messages were more important (e.g. RPM message should be more important than a Temperature message because in one second, temperature will not change dramatically, but RPM can vary a lot).
Messages with higher priority will be then those with more active bits at the beginning of the header.

Message structure:

Structure of a Harley Davidson message: Source: Momex.cat

With this format, the maximum number of bytes is set to 11.

SOF (Start Of Frame)

The node starting to transmit has to start with an active bit during 200us. After this time, it will proceed with the header.


It can be set from 1 to 3 bytes. In the case of Harley Davidson we will find 3 bytes:

Byte #1: It will show to the other nodes the Header configuration (e.g.: 1 o 3 bytes)
Source: Momex.cat
Byte #2: Target address or Primary ID. This value will be available in the SAE J2178-4 and it can be a Command ID or a Status ID.
Byte #3: Source address

Header byte#1 meaning:
Source: Momex.cat

Example (RPM: $28 $1B $10)
$28 Source: Momex.cat

001: Value close to high priority
0: 3 bytes header
1: IFR not necessary
0: Functional address
Target address / Primary ID: RPM - Status ID
Source address (ECM: Engine Control Unit)
Remark: Other source addresses: 40 (Display), 61 (Body Control)
Message body

Target address and message body are specified in the SAE 2178-4 (Message Definition for Three Byte Headers).
Primary IDs use to have Secondary ID that allow to have more detailed information. In the RPM example, the Primary ID ($1B) has 3:

Sec ID 01 - Low resolution - PRN 1022
Sec ID 02 - High resolution - PRN 000C
Sec ID 20 - Idle RPM - PRN 1023

The PRN (Paremeter Reference Number) is a reference that is specified in this SAE 2178-4 for all the Secondary ID. With this PRN we will be able to go to the SAE 2178-2 (Data Parameter Definitions) and know how many bytes we will receive, which formula use to have a decimal value and which units we should expect.

For example, if we look for PRN 000C (RPM - High Resolution), it will tell us that the units are RPM and the resoution is 1/4 (1bit=0,25 rpm). Therefore, if we receive the bytes 28 1B 10 02 0A F0 we will have:

28 1B 10: RPM Header
02: Secondary ID for High Resolution RPM
0A F0: RPM value. To calculate it we will do the following:
(byte0 * 0x100+byte1)/4= (0x0A * 0x100+0xF0)/4
(10 * 256+240)/4= (2560+240)/4= 2800/4= 700rpm

CRC (Cyclical Redundant Check)
It is 1 byte that comes after the message body and it has been obtained by the emitter through a mathematical formula. This number (CRC) is unique for this byte combination (Header + message body). When the receptor node has received all bytes through the bus, it also does this calculation using same formula and will obtain also a CRC. If received CRC and calculated CRC are the same, it means that there was no error during the message transmission-reception. Otherwise, the information of this message should not be taken into consideration.
End of Data (EOD)
After the CRC, the bus will be left in passive mode during 200us. After the EOD, receptor nodes can answer the message or to send a new one.


Broadcasted information through the bus is based in 0s and 1s. This protocol has the characteristic that the broadcasted 1s and 0s can be active and passive.
What does this mean?
It means that as the bus can be in active or passive mode (as explained above), nodes can transmit for example a 1 in active mode or in passive mode by changing only the transmiting time. Following table summarizes it:
Source: Momex.cat Source: Momex.cat

Example using the same 1st byte of the previous header (0x28: 0b00101000): Source: Momex.cat As you can see, the bits alterante every time between active and passive. As the SOF forces the first state (active), the first bit of the header will be passive and the rest will start alternating. All the bits within the bytes of the message will be transmitted starting by the most significant bit, this means bit7, bit6,..., bit0.
Remark: As you can see, a Passive 0 will always win a Passive 1 (0 is temporary shorter and therefore it will change to the next bit (active) sooner and therefore the passive 1 will loose arbitrariety). The same occurs with the Active 0, this is temporary longer than the Active 1.

Specification tables

Source: Momex.cat

Physical Layer:

- 1-wire bus used to transmit 1s and 0s at a specified speed of 10,4 Kb/s through VPW.
- Cable maximum length: 40m
- Maximum number of nodes (Control Units): 32
- A 0 bit will always rule over a 1 bit
- Maximum number of bytes in the message body: 12

Source: Momex.cat

Project Index:
Part1 / Part2 / Part3 / Part4 / Part5 / Part6 / Part7 / Part8 / Part9 / Part10 / Part11 / Part12 / Part13 / Part14 / Part15

keywords: HD, harley, davidson, tachometer, tacho, rpm, J1850, SAE, VPW, specification