cancel
Showing results for 
Search instead for 
Did you mean: 

Why does STM32CubeMX not let me use Disable for Default Polynomial State on STM32L412K8Ux?

Mitja Jež
Associate II

I can not even disable default polynom (in case of STM32L412K8Ux):

0693W000007Bmj9QAC.pngFor 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.

1 ACCEPTED SOLUTION

Accepted Solutions

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:

  •  7-bit long CRC (generating polynomial of degree 7)
  •  8-bit long CRC (generating polynomial of degree 😎
  • 16-bit long CRC (generating polynomial of degree 16)
  • 32-bit long CRC (generating polynomial of degree 32)

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.

 0693W000007Bs7QQAS.png(As indicated in the screenshot above the generated GeneratingPolynomial will be in decimal 32773 =>  0x8005)      

Hope that I answer your question.

Khouloud.

View solution in original post

5 REPLIES 5

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:

  •  7-bit long CRC (generating polynomial of degree 7)
  •  8-bit long CRC (generating polynomial of degree 😎
  • 16-bit long CRC (generating polynomial of degree 16)
  • 32-bit long CRC (generating polynomial of degree 32)

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.

 0693W000007Bs7QQAS.png(As indicated in the screenshot above the generated GeneratingPolynomial will be in decimal 32773 =>  0x8005)      

Hope that I answer your question.

Khouloud.

Mitja Jež
Associate II

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.

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.

0693W000007ZuRVQA0.jpg 

Thanks for your contribution.

Khouloud.

Mitja Jež
Associate II

I installed STM32CubeIDE 1.6.0 that comes with STM32CubeMx 6.2.0 today and I confirm resolved bug. Thank you.

AStaa.1
Associate II

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.