laitimes

The reading of the unique code of the microcontroller

author:APPLE频道

Loading...

I. Preface

  In order to be able to number the calibration data of the device, the unique chip number of the microcontroller, that is, the Unique Device ID, is used as the code of the circuit board, so that the correction value of each measurement circuit board can be uniquely determined. The following implements the process of reading the microcontroller encoding.

The reading of the unique code of the microcontroller

Second, the program implementation

  According to the introduction in the MCU user manual, the encoding of the MCU used now can be used for the serial number of the device, such as the serial string in the USB communication, or the secret key used for the FLASH program encryption of the MCU, and can also be used to activate the encrypted boot process. The corresponding chip serial number of the F373 microcontroller is located in the read-only memory address: 0x1fff F7AC. The address of each series of MCUs is different. Use the program below to read the serial number.

The reading of the unique code of the microcontroller

  Using a pointer, the chip code in the internal space is read. Here the encoded address is converted into a uint32 pointer, which reads three 32-bit data in a row, which is the unique encoded data of the chip.

The reading of the unique code of the microcontroller

3. Test results

  Here through the serial port to receive the chip ID number read by the program, enter the id command, you can see that the program returns the read chip ID number, which is three 32-bit unsigned integer numbers, corresponding to the chip code. For other series of microcontrollers, as long as the starting address is modified, the corresponding chip unique code can be read. Using this code, a unique number can be determined by the bit circuit.

The reading of the unique code of the microcontroller

※Summary※

  This article tests the process of reading the unique encoding of an STM32 microcontroller. According to the encoding start address given in the data sheet, the chip unique ID number is obtained. Based on this code, it can help in the development of software and hardware of the device.

The reading of the unique code of the microcontroller