1
\$\begingroup\$

I am having a problem capturing a specific signal from a CAN bus. Since this task is quite out of my ordinary area of work it might be a pretty simple question.

On the device reading from the CAN I have to specify 7 values:

  • CAN-ID (0x....)
  • Start Bit
  • Bit Length
  • Use Little Endian (yes/no)
  • Sign bit available (yes/no)
  • Use Two's Complement (yes/no)
  • Sign Bit

Information I have about the desired signal:

  • CAN-ID (self explanatory)
  • Byte-order: Motorola
    • Google tells me this leads to 'use little endian: false'
  • Sign bit is available (self explanatory)
  • length: 16 bits
  • DLC = 8
  • Last information I have is a (shortened) layout table of the entire message with my signal marked:

CAN message layout

Long story short my issue is obviously lying in not being familiar with byte ordering and similar things. I still have to specify start-bit, sign-bit and wether or not to use two's complement. Can somebody please help me with what values to enter, as all combinations that made sense to me didn't work so far. Thanks a lot, much appreciated!

\$\endgroup\$
  • \$\begingroup\$ Enter into what? What are you using to monitor the CAN bus? \$\endgroup\$ – Ron Beyer Nov 12 '17 at 21:21
  • \$\begingroup\$ What is an example of an actual value of CAN-ID? What is an example of an actual CAN message? \$\endgroup\$ – Peter Mortensen Nov 12 '17 at 21:39
  • \$\begingroup\$ What is "signal" in this context? Some information about a physical quantity encoded in a CAN message? \$\endgroup\$ – Peter Mortensen Nov 12 '17 at 21:43
  • \$\begingroup\$ Does the content of the table represent 5 CAN messages? \$\endgroup\$ – Peter Mortensen Nov 12 '17 at 21:47
  • \$\begingroup\$ @RonBeyer I am using a measurement device in an automotive context. It needs a certain signal from the vehicle CAN for it's calculations, the electrics itself is ready to go, I just need to specify in the provided software 'where exactly to find that'. \$\endgroup\$ – user168677 Nov 12 '17 at 23:35
0
\$\begingroup\$

All of this has very little to do with CAN. The only CAN terms here is CAN-ID and DLC, the latter meaning the data size in bytes (from 0 to 8).

The rest of the terms define something on a higher level than the CAN protocol itself, namely the carried data. CAN allows you to send any data you please over 0 to 8 bytes per package. It does not define or care what that data is.

Therefore it is not quite clear what you are trying to do here. Your tool seems strange and specialized, making assumptions about the higher level protocol used.

Explanation of the various technical terms:

Start Bit & Bit Length
"Start bit" is not applicable to CAN systems. Start bits are used in UART and similar protocols. Someone is using the wrong term, or this refers to some secret bit in the data. Bit length probably refers to the length of one particular data item in the protocol sent, such as 16 bits.

Little Endian vs Big Endian
This refers to the byte order of integer data, for integers that are larger than 1 byte. Wikipedia can give you the full story. Basically, in the 1980s the Intel camp preached Little Endian (ls byte at ls address) and the Motorola camp preached Big Endian (ms byte as ls address).

This can only refer to the data carried by the CAN package. the CAN low-level protocol itself has no endianess. (Other than in the CRC-15, which fixed Big Endian, you can't change it.)

Sign bit available, Two's Complement, Sign Bit
These all mean the same thing. These must refer to the data. Supposedly they are asking if signed numbers apply, and if so, what is the format. Apparently the option is two's complement (most common) or signed magnitude. If you don't know what two's complement is, then Wikipedia & study.


To sum it up, you can't do a thing with what you have. You must have a proper specification of what the higher level protocol is supposed to be and what format it has. Nobody on the Internet can tell you what data a particular non-standard protocol somewhere is sending out. The CAN standard does not specify this.

You show some table with 5 data bytes and say that DLC is 8 bytes. That doesn't make any sense. Supposedly you are to read a 16 bit data byte in Big Endian, two's complement format from byte 2 and 3.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.