crc

CAN FD协议简介

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-30 09:47:38
在汽车领域,随着人们对数据传输带宽要求的增加,传统的CAN总线由于带宽的限制难以满足这种增加的需求。此外为了缩小CAN网络(max. 1MBit/s)与FlexRay(max.10MBit/s)网络的带宽差距,BOSCH公司2011年推出了CAN FD方案 。 CAN FD(CAN with Flexible Data rate)继承了CAN总线的主要特性。CAN总线采用双线串行通讯协议,基于非破坏性仲裁技术,分布式实时控制,可靠的错误处理和检测机制使CAN总线有很高的安全性,但CAN总线带宽和数据场长度却受到制约。CAN FD总线弥补了CAN总线带宽和数据场长度的制约,CAN FD总线与CAN总线的区别主要在以下两个方面: 可变速率 CAN FD采用了两种位速率:从控制场中的BRS位到ACK场之前(含CRC分界符)为可变速率,其余部分为原CAN总线用的速率,即仲裁段和数据控制段使用标准的通信波特率,而数据传输段时就会切换到更高的通信波特率,数据传输速率可大于。两种速率各有一套位时间定义寄存器,它们除了采用不同的位时间单位TQ外,位时间各段的分配比例也可不同。 新的数据场长度 CAN FD对数据场的长度作了很大的扩充,DLC最大支持64个字节,在DLC小于等于8时与原CAN总线是一样的,大于8时有一个非线性的增长,所以最大的数据场长度可达64字节。 CAN FD 介绍 1. CAN

redis-CRC16

徘徊边缘 提交于 2019-12-28 11:53:44
CRC16 当数据帧长度在8bits-128bits范围内时,推荐CRC-8(CRC-8能够减少额外比特的开销,且有更好的性能表现) 当数据帧长度在128bits-2048bits范围内时,推荐CRC-12,CRC-16,CRC-CCITT(CRC-12额外比特的开销更小,且用于6bit字符流的传输;对于16bits的标准,更推荐美国标准CRC-16,性能略优于CRC-CCITT); 当因数据帧长度更长、信道不稳定等情况而需要更高的性能时,CRC-32、CRC-32C将是更好的选择; Redis-基于字节查表法的CRC校验码生成算法 CRC16的校验码是两个字节,所以Redis的源码中使用了 uint16_t类型(unsigned short int) CRC16要校验的数据位是8位 在求解CRC校验码的过程中,会用到模二除,实际我们最后不关心它的商Q(x),只关心关心余数R(x),它也是两个字节的大小 余数R(x)分为高字节RH(x)和低字节RL(x)两个部分:R(x) = RH(x) * X^8 + RL(x) (这个+,可以理解成异或,也可以理解成+号) 任何数和0异或结果还是这个数 流程 CRC-16码由两个字节构成,在开始时CRC寄存器的每一位都预置为1 然后把CRC寄存器与8-bit的数据进行异或 之后对CRC寄存器从高到低进行移位,在最高位(MSB)的位置补零

CRC8 with X^8 + X2 + X + 1 Working java source code [duplicate]

為{幸葍}努か 提交于 2019-12-26 09:24:11
问题 This question already has answers here : What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? (25 answers) Closed 3 years ago . I want a working Java source code for calculation of CRC8 byte for Array of bytes. I tested many, but all of them stop in middle because the index of CRC8 TABLE went Out Of Bounds with this error. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 255 at com.exelonix.model.CRC.crc_update(CRC.java:45) at com.exelonix.model

CRC8 with X^8 + X2 + X + 1 Working java source code [duplicate]

扶醉桌前 提交于 2019-12-26 09:23:23
问题 This question already has answers here : What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? (25 answers) Closed 3 years ago . I want a working Java source code for calculation of CRC8 byte for Array of bytes. I tested many, but all of them stop in middle because the index of CRC8 TABLE went Out Of Bounds with this error. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 255 at com.exelonix.model.CRC.crc_update(CRC.java:45) at com.exelonix.model

CRC8 with X^8 + X2 + X + 1 Working java source code [duplicate]

此生再无相见时 提交于 2019-12-26 09:21:27
问题 This question already has answers here : What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? (25 answers) Closed 3 years ago . I want a working Java source code for calculation of CRC8 byte for Array of bytes. I tested many, but all of them stop in middle because the index of CRC8 TABLE went Out Of Bounds with this error. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 255 at com.exelonix.model.CRC.crc_update(CRC.java:45) at com.exelonix.model

How to calculate CRC checksum in Actionscript 3?

倾然丶 夕夏残阳落幕 提交于 2019-12-25 02:55:57
问题 I am developing an application in flex in which I need to calculate checksum of different files. I would like to know if there is a direct method in actionscript to calculate that or do I have to go for any external libraries? Thanks in advance :) 回答1: as3corelib maintained by Mike Chambers/Adobe, contains everything you probably need in its crypto section including: HMAC MD5 MD5Stream SHA1 SHA224 SHA256 WSSEUsernameTocken 回答2: how do you use this as3corelib to perform a md5 on a file i.e. "c

Python: binary string error simulation

孤者浪人 提交于 2019-12-24 07:59:11
问题 I am currently writing a test for validating some error-correcting code: inputData1 = "1001011011" inputData2 = "1001111011" fingerPrint1 = parityCheck.getParityFingerprint(inputData1) # Expected: fingerPrint1=0 fingerPrint2 = parityCheck.getParityFingerprint(inputData2) # Expected: fingerPrint2=1 if fingerPrint1 == fingerPrint2: print "Test failed: errorCorrectingAlgo1 failed to detect error" else: print "Test success: errorCorrectingAlgo1 successfully detected error" Is there a python class

CRC-CCITT Kermit 16 in C#

旧时模样 提交于 2019-12-24 07:56:42
问题 Attempting to reverse engineer a serial port protocol. I am unable to recreate the crc-16 bytes. According to the documentation, this is the format of the packet 48 45 4c 4f // HELO 01 00 00 01 // ARG 1 00 00 00 00 // ARG 2 00 00 00 00 // ARG 3 00 00 00 00 // ARG 4 00 00 00 00 // REQUEST BODY 5c b1 00 00 // CRC-16 b7 ba b3 b0 // Bit-wise inversion of HELO command This is the write command that was sniffed from serial monitoring 48 45 4c 4f 01 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Crcmod python3 polynomial error

旧城冷巷雨未停 提交于 2019-12-24 04:58:10
问题 I need to use a crc checksum in a python3 program, but my knowledge of crc is virtually non-existent. Here is the test code I wrote import crcmod crc_func = crcmod.mkCrcFun(0x1d, initCrc=0x07, xorOut=0x00) print(hex(crc_func(b'123456789'))) When I run this, I get the following error: ValueError: The degree of the polynomial must be 8, 16, 24, 32 or 64 But 1D is 8 bit, so I must be doing something wrong. Please explain what I did wrong. 回答1: But 1D is 8 bit No it isn't; it's 5 bits: >>> bin

Difference in Boost CRC and linux/lib/crc-ccitt.c

荒凉一梦 提交于 2019-12-24 04:24:08
问题 I have two sources to calculate the seemingly same crc value. I can not figure out why the 'boost/crc.hpp' implementation differs from the 'linux/lib/crc-ccitt.c' implementation. crc-ccitt.c boost Here is an example that illustrates the Problem. It is sligthly longer since i do not have the Linux kernel source on my Computer. It compiles if you link boost to it. The Problem is that Linux and boost do not agree on the crc value. The Linux source states that: The polynomial ... 0x8408. Add the