Go to file
rusefillc 21cacf8c54 Overview Motorola vs. Intel-Format in Can-Frame
Some explanations of CAN byte order and bit numbering:

openxcplatform-bitnumbering

Mathworks-Side

CAN frame data is either in big endian or little endian byte format.

The bits are numbered by the file format either using MSB first (MSB0) or LSB first (LSB0).

With "consistent" format/numbering, bit numbering follows the byte format. MSB0 for big endian, LSB0 for little endian.

ietf-endianess

Usually the start bit referenced by the file formats reference the start of the signal data within the message independent of the endianess of the signal. With some formats (DBF), the startbit may always reference the LSB of the signal data.

Common formats:

KCD, SYM (consistent bit numbering)

little,LSB0
big,MSB0
DBC, ARXML (OSEK bit numbering)

little,LSB0
big,LSB0 (inconsistent)
DBF (startBit=LSB, startByte and startBit specified separately)

little,LSB0
big,LSB0,startBit=LSB (inconsistent)
Legacy canmatrix (yaml, json) (Note: internally canmatrix now uses consistent bit numbering)

little,LSB0
big,LSB0,startBit=LSB (inconsistent)
###First Example:

Frame with two 32-bit signals in motorola one can-frame

 7 6 5 4 3 2 1 0
0>msb-----
1  signal1
2
3       ----lsb>
4>msb-----
5  signal2
6
7       ----lsb>
DBC:

BO_ 291 newFrameMotorola: 8 Vector__XXX
 SG_ signal1 : 7|32@0- (1,0) [0|0] "" Vector__XXX  (most significant bit)
 SG_ signal2 : 39|32@0- (1,0) [0|0] "" Vector__XXX (most significant bit)
candb++ views:

signal1: 24 (least significant bit?)
signal2: 56 (least significant bit?)
Dbf:

byte 4 bit 0
byte 8 bit 0
###Second Example:

 7 6 5 4 3 2 1 0
0        >msb---
1---------lsb>
2
3
4
5
6
7
DBC:

startbit 3
length 11
candb++ views:

Startbit 9 (least significant bit?)
dbf:

length 11
byte 2 (counting starts with byte 1)
bit 1
##found docs about kcd "Least significant bit offset of the signal relative to the least significant bit of the messages data payload." least significant bit?

estimation about dbf
least significant bit?

new formulars from dmahurin
Note the basic operations used.

convert from lsb0 bit numbering to msb0 bit numbering (or msb0 to lsb0)
b = b - (b % 8) + 7 - (b % 8)

convert from lsbit of signal data to msbit of signal data, when bit numbering is msb0
b = b + 1 - length

convert from msbit of signal data to lsbit of signal data, when bit numbering is msb0
b = b + length - 1

So conversion from msbit in lsb0 bit numbering to msbit in lsb0 bit numbering is:

b = b - (b % 8) + 7 - (b % 8)

b = b + length - 1

b = b - (b % 8) + 7 - (b % 8)

byte order names
little endian == Intel == MOST-SIGNIFICANT-BYTE-LAST

big endian == Motorola == MOST-SIGNIFICANT-BYTE-FIRST
2024-11-06 21:54:49 -05:00
.github/workflows
.run
ext
gradle/wrapper
opendbc@098ba88138
output
playback
random yFrom 2024-10-24 22:01:25 -04:00
reader Overview Motorola vs. Intel-Format in Can-Frame 2024-11-06 21:54:49 -05:00
.gitignore
.gitmodules
README.md Update README.md 2024-10-24 11:55:00 -04:00
build.gradle
dependencies.gradle
example-nick.bat
gradle.properties
gradlew
gradlew.bat
have_fun.bat
settings.gradle PinoutTemplate 2024-10-22 06:41:37 -04:00

README.md

CAN file processing

  • split trace file by packet ID
  • per-ID comparison of multiple trace files
  • counter bit region detection
  • charting using MegaLogViewer
gradlew :reader:shadowJar
java -jar reader/build/libs/reader-all.jar "C:\stuff\rusefi_documentation\OEM-Docs\VAG\2006-Passat-B6" -filter passat-back-and-forth-60-seconds -dbc opendbc/vw_golf_mk4.dbc

CAN playback

CAN playback using PCAN on Windows or SocketCAN on Linux.

gradlew :playback:shadowJar
java -jar playback/build/libs/playback-all.jar playback/src/main/resources/atlas.trc

CAN decoding hints

CAN log file utilities to help me work with https://github.com/brent-stone/CAN_Reverse_Engineering and https://github.com/HeinrichG-V12/E65_ReverseEngineering

  • turning ignition on (wake up)
  • OEM ECU remove, turning ignition on (wake up)
  • turning ignition off (shutdown)
  • from ignition ON cranking and idling
  • just idling
  • ignition on, engine not running, press clutch four times
  • ignition on, engine not running, brake pedal three times
  • ignition on, engine not running, throttle pedal from 0% to 50%, to 0%, to 100%, to 0%
  • engine running, rev from 1500 rpm to 3000 rpm

See also

https://github.com/ElDominio/CANBUSlogs