crc16

STM32串口如何代码实现更稳定的接收消息

好久不见. 提交于 2020-04-09 12:13:28
在 《STM32串口向世界问好》 介绍过如何发送消息,那么又如何接收消息呢? 也很简单,只需要配置好串口接收,配置好中断,并在串口中断函数里面进行数据接收就可以了。通用配置代码如下: /** * @brief 初始化IO 串口1 * @param bound:波特率 * @retval None */ void USART1_Debug_Init(u32 bound) { //GPIO端口设置 GPIO_InitTypeDef GPIO_InitStructure; USART_InitTypeDef USART_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; assert_param(bound >0 && bound <= 256000); RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA, ENABLE); USART_DeInit(USART1); //复位串口1 //USART1_TX PA.9 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; //PA.9 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure

How do I implement a CRC16 with a custom polynomial in Javascript?

时光总嘲笑我的痴心妄想 提交于 2020-02-16 06:37:23
问题 Background I need to implement a CRC16 with a custom polynomial in Javascript. Research After searching several NPM modules and this SO question ( as well as all the links the comments suggest ): Javascript CRC16 sample code or implementation https://github.com/donvercety/node-crc16 I am still not any closer to my goal. Problem My problem is that even though I have the code, I can't understand how to re-use a given CRC16 solution because I don't know where to find the polynomial definition in

How do I implement a CRC16 with a custom polynomial in Javascript?

被刻印的时光 ゝ 提交于 2020-02-16 06:35:13
问题 Background I need to implement a CRC16 with a custom polynomial in Javascript. Research After searching several NPM modules and this SO question ( as well as all the links the comments suggest ): Javascript CRC16 sample code or implementation https://github.com/donvercety/node-crc16 I am still not any closer to my goal. Problem My problem is that even though I have the code, I can't understand how to re-use a given CRC16 solution because I don't know where to find the polynomial definition in

Find used CRC-16 algorithm

会有一股神秘感。 提交于 2020-01-06 05:21:44
问题 I'm struggling to reverse engineer a section of data associated with a CRC-16 checksum. I know the polynom used to calculate the original checksums is 0x8408 but nothing else, I don't know initial value (if any), final XOR value (if any), if the input or the result is reflected... It seems like there is a known CRC-16 generator using thing polynom, CRC-16-CCITT but despite everything I've tried I just can't understand how the original checksum is being calculated. Here is the data I've got

CRC16 and data communications

一个人想着一个人 提交于 2020-01-05 07:57:14
问题 Hi I have been trying to calculate a CRC for a device I want to write a software interface for. For simplicity I will say X is the device and Y is the hardware controller. I am looking for a nudge in the right direction I am sure I am on the correct track just a little confused on a few points. When the device is idle it sends the following strings of data every 2 seconds or so that looks like it is counting up in hex: The 2 bytes between the | | is the CRC I assume. (XX) is the varying byte.

CCITT CRC 16 Bit Start Value 0xffff

纵然是瞬间 提交于 2020-01-01 05:38:07
问题 I need to calculate a CCITT 16 bit checksum value for data passed as a parameter together with the length. If I fill my array TempStr with the test data "123456789", use the polynomial 0x8408 with the length excluding the null termination character, I get the result string 6E90(Hex). Together with the null termination char I get 907A. When I swap out the polynomial to 0x1201 then I get results 29E2(Hex) and EFE8(Hex) with and without termination character. My questions are: Do I need to

Convert C to PHP for CRC16 Function

旧城冷巷雨未停 提交于 2019-12-30 06:59:18
问题 I need help in converting C code into PHP. The following is the C Code: static const U16 crctab16[] = { 0x0000, 0x1189, ... }; U16 GetCrc16(const U8* pData, int nLength) { U16 fcs = 0xffff; while(nLength > 0) { fcs = (fcs >> 8) ^ crctab16[fcs ^ *pData) & 0xff]; nLength--; pData++; } return ~fcs; } I have the following PHP code that I have managed to convert thus far: $crctab16 = array(0x0000, 0x1189, ... ); function getCrc16($pData) { $hexdata = pack('H*',$pData); $nLength = strlen($hexdata);

C# CRC-16-CCITT 0x8408 Polynomial. Help needed

笑着哭i 提交于 2019-12-25 18:25:43
问题 I am new in communications programming. Basically, I need to get the hex equivalent of the CRC output. I have a hex string which is the parameter - EE0000000015202020202020202020202020323134373030353935 This is concatenation of two strings. The output I need is E6EB in hex or 59115 in ushort . I tried different approaches based on what I found in the web but to no avail. The polynomial that I should be using is 0x8408 , which is [CRC-16-CCITT][1] , http://en.wikipedia.org/wiki/Polynomial

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

MODBUS RTU CRC16 calculation

核能气质少年 提交于 2019-12-24 07:45:26
问题 I'm coding a MODBUS CRC16 calculator in C. What I have before is a python that do this, I wanted to convert it to C. I found some codes online but it's not giving me the correct answer. For my python code, I have this as my CRC16.py #!/usr/bin/env python def calc(data): crc_table=[0x0000,0xC0C1,0xC181,0x0140,0xC301,0x03C0,0x0280,0xC241,0xC601,0x06C0,0x0780,0xC741,0x0500,0xC5C1,0xC481,0x0440,0xCC01,0x0CC0,0x0D80,0xCD41,0x0F00,0xCFC1,0xCE81,0x0E40,0x0A00,0xCAC1,0xCB81,0x0B40,0xC901,0x09C0