mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-04 22:09:57 +02:00
canbusload: Add exact CAN frame length calculation (including bitstuffing)
This adds an algorithm for calculating the exact number of bits a CAN frame occupies on the bus and uses this algorithm in canbusload. It also moves the other methods for CAN frame length calculation, already present in canbusload, to the new file. The added algorithm calculates the exact number of stuffed bit in a CAN frame. Note that in order to calculate that correctly, we must also know the frame's CRC. Hence, the algorithm also includes CRC calculation routine. The correctness of the algorithm was verified on an oscilloscope for several different SFF and EFF frames. Currently only CAN frames are supported. For CANFD frames, a different algorithm is needed. CANFD uses different CRC polynomials and calculates the CRC from the staffed bit-stream (CAN calculates CRC from de-stuffed bit-stream). Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
committed by
Marc Kleine-Budde
parent
4ddde7b966
commit
2206f92de7
@@ -81,6 +81,7 @@ canbusload.o: lib.h
|
||||
log2long.o: lib.h
|
||||
log2asc.o: lib.h
|
||||
asc2log.o: lib.h
|
||||
canframelen.o: canframelen.h
|
||||
|
||||
cansend: cansend.o lib.o
|
||||
cangen: cangen.o lib.o
|
||||
@@ -90,3 +91,4 @@ canlogserver: canlogserver.o lib.o
|
||||
log2long: log2long.o lib.o
|
||||
log2asc: log2asc.o lib.o
|
||||
asc2log: asc2log.o lib.o
|
||||
canbusload: canbusload.o canframelen.o
|
||||
|
||||
Reference in New Issue
Block a user