ChatGPT: Microcontroller question: using CRC16 to reduce 96-bit device ID?

Highlights thread as a discussion with ChatGPT

Welcome to the Precious Metals Bug Forums

Welcome to the PMBug forums - a watering hole for folks interested in gold, silver, precious metals, sound money, investing, market and economic news, central bank monetary policies, politics and more.

Why not register an account and join the discussions? When you register an account and log in, you may enjoy additional benefits including no Google ads, market data/charts, access to trade/barter with the community and much more. Registering an account is free - you have nothing to lose!

Someone_else

Ground Beetle
GIM2 Refugee
Messages
508
Reaction score
424
Points
238
Many microcontrollers have a unique manufacturer ID available to software. For example, the STM8S103, STM32F103, and CH32V003 have a 96-bit ID that can be read.
If I have a small network of these (10 to 20), would a CRC16 of the unique ID give a 16 bit node identifier that is unlikely to collide with another?
Would a 16-bit CRC with a different polynomial give a better result?
 
Using a CRC16 checksum of the 96-bit unique ID to generate a 16-bit node identifier for your small network of 10 to 20 devices is a reasonable approach to reduce the ID size and avoid collisions. However, it's important to note that collisions are still possible due to the nature of CRC algorithms.

CRC16 checksums are commonly used for error detection and can provide a compact representation of the input data. They are good at creating unique identifiers, but they are not foolproof in preventing collisions, especially with a relatively small range like 16 bits and a limited number of devices in the network.

Choosing the right polynomial for the CRC algorithm is crucial in minimizing the chances of collisions. Some polynomials are better suited for generating unique checksums than others. The selection of the polynomial will affect the error-detection capabilities and the uniqueness of the generated checksums.

You may need to experiment with different CRC polynomials to find one that best fits your specific requirements. Additionally, consider implementing some form of addressing or communication protocol that allows for fallback mechanisms in case of collisions, such as reassigning IDs or using unique node prefixes.

In summary, using a CRC16 checksum of the 96-bit unique ID to create a 16-bit node identifier can be effective for small networks, but be aware of the limitations and take steps to mitigate potential collisions. Experiment with different CRC polynomials to find the best one for your scenario.
 
Back
Top Bottom