Thanks to EEWORLD and ST for providing development boards, board information address
Since I used the development tool of Keil 5.18a, I encountered a problem: the ST-LINK V3 version on the board could not download the program, so I had to use the ST-LINK tool to download the Hex file to the board for experiment. But at least I can do the experiment. So I clicked the LED and did the serial port experiment at the same time, and everything went smoothly. The serial port uses LPUART1, and the pins are PA2/PA3.
There are built-in CRC calculation and RNG generator on the chip, so I first did the CRC calculation experiment. I found that the calculation speed is really fast!
If you want to use the CRC calculation accelerator, you need to initialize and set parameters. This operation is very convenient in STM32CUBE.
STM32CUBE defaults to 32-bit CRC, and 16-bit is commonly used. The following describes the setting items:
Default Polynomial State Whether to use a customized algorithm and checksum
CRC Length CRC checksum length, default 32-bit
CRC Generating Polynomial Specify the 'checksum'
Default Init Value State Specify the first byte, default is 'FF'
Input Data Inversion Mode Calculation direction of input data
Output Data Inversion Mode Calculation direction of output data
Input Data Format Bit width of input data, default is 'byte'
After setting the initialization parameters, you can use the HAL_CRC_Calculate(&hcrc, (uint32_t *)txData, sizeof(txData)); function. The return value of the function is the calculation result of CRC.
Display CRC result through serial port debugging assistant
This content is originally created by bigbat , a netizen of EEWORLD forum. If you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source