4

AN017: CRC Calculations For M-Bus Modules

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: AN017: CRC Calculations For M-Bus Modules

We Make Embedded Wireless Easy to Use

AN017: CRC CALCULATIONSFOR MBUS MODULES

Page 2: AN017: CRC Calculations For M-Bus Modules

Page 2 of 4

APPLICATION NOTE: AN017

2017 Radiocrafts AS Application Note AN017 (rev. 1.1)

CRC Calculations for MBUS Modules By H.Moholdt

Introduction

The Wireless M-Bus modules (MBUS3, MBUS4) from Radiocrafts can be enabled with CRC-16 for possible

error identification on the UART port. This feature secures that the data handling on the serial interface is

more secure as wrong data can be rejected.

CRC Introduction

Enter config mode and send M-command and sequence ‘0x51 0x04 0xFF’, then exit config mode via X.

The CRC calculation is referenced in FT3 of EN60870-5-1, the same as used in Wireless M-Bus. It uses the

following generator polynomial;

x16+ x13+ x12+ x11+ x10+ x8+ x6+ x5+ x2+ x0

The initial value is 0x0000, the polynomial is 0x3D65 as shown above, and the result is inverted. The most

significant byte of the 16-bit CRC is transmitted first.

To calculate the CRC manually, several online programs can be used, like for instance

http://zorc.breitbandkatze.de/crc.html which returns a CRC result for a Wireless M-bus telegram. The data

sequence can be manually entered into the program and the coded result will be displayed.

CRC handling on MBUS UART

The message from the module’s UART (which it is sending to the host), with UART CRC enabled in DATA_INTERFACE, is calculated from and including the original length byte (excl the two CRC bytes), to and including the RSSI append byte (if enabled). Start/stop bytes (if enabled) are not included in the CRC calculation, and not the CRC bytes itself. Thus, the following general procedure applies to a received UART-message from a module where CRC is enabled; -Remove the start/stop byte(s) -Remove the two CRC bytes and reduce the length byte by 2 -Then calculate the CRC over the remaining frame (including any RSSI), starting with the length byte -Invert the result -Compare with the received CRC.

Page 3: AN017: CRC Calculations For M-Bus Modules

Page 3 of 4

APPLICATION NOTE: AN017

2017 Radiocrafts AS Application Note AN017 (rev. 1.1)

Document Revision History

Document Revision Changes 1.0 First release

1.1 Design Update

Disclaimer

Radiocrafts AS believes the information contained herein is correct and accurate at the time of this printing. However, Radiocrafts AS

reserves the right to make changes to this product without notice. Radiocrafts AS does not assume any responsibility for the use of

the described product; neither does it convey any license under its patent rights, or the rights of others. The latest updates are available

at the Radiocrafts website or by contacting Radiocrafts directly.

As far as possible, major changes of product specifications and functionality, will be stated in product specific Errata Notes published

at the Radiocrafts website. Customers are encouraged to check regularly for the most recent updates on products and support tools.

Trademarks

RC232™ is a trademark of Radiocrafts AS. The RC232™ Embedded RF Protocol is used in a range of products from Radiocrafts. The

protocol handles host communication, data buffering, error check, addressing and broadcasting. It supports point-to-point, point-to-

multipoint and peer-to-peer network topologies.

All other trademarks, registered trademarks and product names are the sole property of their respective owners.

Life Support Policy

This Radiocrafts product is not designed for use in life support appliances, devices, or other systems where malfunction can

reasonably be expected to result in significant personal injury to the user, or as a critical component in any life support device or

system whose failure to perform can be reasonably expected to cause the failure of the life support device or system, or to affect its

safety or effectiveness. Radiocrafts AS customers using or selling these products for use in such applications do so at their own risk

and agree to fully indemnify Radiocrafts AS for any damages resulting from any improper use or sale.

© 2017, Radiocrafts AS. All rights reserved.

Page 4: AN017: CRC Calculations For M-Bus Modules

www.radiocrafts.com

Email: [email protected]

Tel: +47 4000 5195

For More Information,Please Visit Our Website!

VISIT NOW