Skip to main content
Mahdi1
Associate
August 4, 2022
Solved

STM32f030k6 CRC Config error

  • August 4, 2022
  • 9 replies
  • 3742 views

I want to use CRC on STM32f030k6, but as soon as I enable it, some errors appear and compilation fails.

Even when I want to use EEPROM Emulation example for the above micro, again it fails to compile.

What is wrong?

STM32CubeIDE - Version: 1.10.1

STM32CubeF0 Firmware Package V1.11.0

This topic has been closed for replies.
Best answer by Mahdi1

Final Answer:

Yes, As you said and based on f030 datasheet, it has a 32bit fixed polynomial. I hope in the next version of STM32CubeIDE, the issue will be resolved (Enabling CRC for f030 makes error).

Thanks for all participants.

0693W00000QNUq7QAH.png

9 replies

waclawek.jan
Super User
August 4, 2022

> some errors appear

What errors?

Is there CRC in the 'F030 at all? What does the RM say?

JW​

Mahdi1
Mahdi1Author
Associate
August 4, 2022

../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_crc.c:131:29: error: 'CRC_TypeDef' has no member named 'POL'

and

../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_crc.h:191:45: error: 'CRC_CR_POLYSIZE' undeclared (first use in this function)

and

../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_crc.h:190:45: error: 'CRC_CR_POLYSIZE_1' undeclared (first use in this function)

and...

  • Is there CRC?

Based on its datasheet and also Cube Configurations, yes it has CRC.

waclawek.jan
Super User
August 4, 2022

You probably don't have properly selected the exact STM32 model, or have some old Cube libraries.

The 'F030 don't have a fixed polynomial, so they don't have the CRC_POL register in CRC (more precisely, it's read only) and don't have the POLYSIZE field in CRC_CR.

In other words, the code should not refer to them for 'F030 (thus should not throw error). In current https://github.com/STMicroelectronics/STM32CubeF0/blob/master/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_crc.c at the line where you give the error, indeed CRC->POL is written, but that part of code is guarded by #if defined(CRC_POL_POL) at line 124 above, and CRC_POL_POL should not be defined - and indeed, it is not defined in the stm32f030x6.h device header.

That's why I think you haven't properly selected the STM32 model in the IDE.

JW

Mahdi1
Mahdi1Author
Associate
August 4, 2022

Thanks Jan for your reply,

my Cube Libraries are up-to-date as mentioned above.

I need CRC for EEPROM Emulation. I wanted to reuse and adapt the code:

STM32Cube\STM32Cube_FW_F0_V1.11.3\Projects\STM32F091RC-Nucleo\Applications\EEPROM\EEPROM_Emulation

for STM32f030k6; but as you say, it has no CRC!

Would you please tell me what to do?

waclawek.jan
Super User
August 4, 2022

You need to select STM32F030 instead of STM32F091.

I don't use Cube so don't know where to click.

JW

Mahdi1
Mahdi1Author
Associate
August 4, 2022

Which IDE do you use?

But you say STM32F030 has no CRC! any other solution to make use of CRC on this mcro?

Mahdi1
Mahdi1Author
Associate
August 4, 2022

0693W00000QMxVGQA1.jpg

Mahdi1
Mahdi1Author
Associate
August 4, 2022

It seems to have CRC. Am I right?

Tesla DeLorean
Guru
August 4, 2022

Yes, the basic one, not one where you can configure the polynomial, width or feed details.

So CRC_CR_POLYSIZE doesn't exist on this part.

You'll need to double check what STM32F0 you're telling the compiler you're building with, as there appears to be some mismatch configuration in your project.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Mahdi1
Mahdi1AuthorBest answer
Associate
August 11, 2022

Final Answer:

Yes, As you said and based on f030 datasheet, it has a 32bit fixed polynomial. I hope in the next version of STM32CubeIDE, the issue will be resolved (Enabling CRC for f030 makes error).

Thanks for all participants.

0693W00000QNUq7QAH.png

Mahdi1
Mahdi1Author
Associate
August 5, 2022

As far as I investigated, the first part of your statement is right: STM32F0 has a simple CRC with limited settings.

But about the second part, I make no mistake choosing my micro from the list.

I think the problem is due to STMCubeIDE lacking integrity and compatibility. Because even if I choose STM32f030k6 and enable its CRC in simplest mode, again the above errors appear!

Tesla DeLorean
Guru
August 5, 2022

I'm not using CubeMX/CubeIDE and this code generation / boilerplate stuff, so I'm not going to get into an argument about who's fault specifically this is, as honestly I don't care.

You're trying to compile a project where the code, the settings, or something is internally inconsistent, and divergent from reality.

Modify the code or project metadata so that it works with CPU you have. It's perhaps a define somewhere, in one of the files, or passed to the compiler's command line.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..