2021-01-19 02:22 AM
I can not even disable default polynom (in case of STM32L412K8Ux):
For STM32G071 it allow me to disable default, but it force on some value (probably default) - it does not allow to enter our own.
I would like to set 0x8005 polynom in cubeMX instead of editing code later.
Solved! Go to Solution.
2021-01-19 08:21 AM
Hello Mitja Jež,
Thanks for your feedback. You're right normally STM32CubeMX gives both possibilities to Enable and Disable the Default Polynomial State for STM32L412K8Ux MCU.
I will report your feedback internally to be reviewed and checked. I will keep you posted.
Thanks again for your contribution.
> For STM32G071 it allow me to disable default, but it force on some value (probably default) - it does not allow to enter our own.
In fact, by disabling the Default Polynomial State, CubeMX will automatically gives you the possibility to configure two other parameters:
CRC Length: This parameter the indicates CRC length, it can be one of the following values:
CRC Generating Polynomial:
It should respect this format : Xa+Xb+...+Xc+X0.
where a,b,c are the powers of the polynomial :
- a,b,c must be less than chosen degree .
- The polynomial must contain X0.
No need to indicate the highest polynomial degree as it is deduced from the CRC Length
Set CRC generating polynomial as a 7, 8, 16 or 32-bit long value for a polynomial degree respectively equal to 7, 8, 16 or 32. This field is written in normal representation, e.g., for a polynomial of degree 7, X^7 + X^6 + X^5 + X^2 + 1 is written 0x65.
(As indicated in the screenshot above the generated GeneratingPolynomial will be in decimal 32773 => 0x8005)
Hope that I answer your question.
Khouloud.
2021-01-19 08:21 AM
Hello Mitja Jež,
Thanks for your feedback. You're right normally STM32CubeMX gives both possibilities to Enable and Disable the Default Polynomial State for STM32L412K8Ux MCU.
I will report your feedback internally to be reviewed and checked. I will keep you posted.
Thanks again for your contribution.
> For STM32G071 it allow me to disable default, but it force on some value (probably default) - it does not allow to enter our own.
In fact, by disabling the Default Polynomial State, CubeMX will automatically gives you the possibility to configure two other parameters:
CRC Length: This parameter the indicates CRC length, it can be one of the following values:
CRC Generating Polynomial:
It should respect this format : Xa+Xb+...+Xc+X0.
where a,b,c are the powers of the polynomial :
- a,b,c must be less than chosen degree .
- The polynomial must contain X0.
No need to indicate the highest polynomial degree as it is deduced from the CRC Length
Set CRC generating polynomial as a 7, 8, 16 or 32-bit long value for a polynomial degree respectively equal to 7, 8, 16 or 32. This field is written in normal representation, e.g., for a polynomial of degree 7, X^7 + X^6 + X^5 + X^2 + 1 is written 0x65.
(As indicated in the screenshot above the generated GeneratingPolynomial will be in decimal 32773 => 0x8005)
Hope that I answer your question.
Khouloud.
2021-01-19 08:48 AM
OK, I understand now about what I thought that it's problem.
I need CRC for MODBUS Polynomial: x16 + x15 + x2 + 1 (CRC-16-ANSI also known as CRC-16-IBM, normal hexadecimal algebraic polynomial being 0x8005 and reversed
0xA001).
I wanted to write X16+X15+X2+X0 but it correcting me into X15+X2+X0 what is actually OK. Because we have 16bit long value.
> No need to indicate the highest polynomial degree as it is deduced from the CRC Length
About STM32L412K8Ux, luckily I can add just following lines in /* USER CODE BEGIN CRC_Init 1 */ segment and auto-generating code does not overrride it.
hcrc.Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_DISABLE;
hcrc.Init.GeneratingPolynomial = MODBUS_CRC_POLY;
hcrc.Init.CRCLength = CRC_POLYLENGTH_16B;
This will not hold my development, but I'll follow updates on this.
I'll also test it on STM32L412KBUx, and report about it here.
2021-03-02 07:25 AM
Hi @Mitja Je? ,
Good news :) I am pleased to inform you that this issue is fixed in the latest STM32CubeMX version 6.2.0.
You're able now to enable and disable the Default Polynomial State through the STM32CubeMX interface.
Thanks for your contribution.
Khouloud.
2021-03-25 03:16 PM
I installed STM32CubeIDE 1.6.0 that comes with STM32CubeMx 6.2.0 today and I confirm resolved bug. Thank you.
2021-12-01 09:59 AM
Hello @Khouloud OTHMAN
I am having the same problem with the STM32F030C8.
I am using STM32Cube IDE 1.7 on Linux Mint.
The library packages are: STM32Cube_FW_F0_V1.11.3.
Can you check it out? I am very grateful.