cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMx STM32F4 1.11 SPI critical bug introduced in codegenerator

taraben
Senior
Posted on February 13, 2016 at 22:31

Hello,

in the new CubeMx STM32F4 1.11 library there is a new bug introduced.

There is this new feature:

Add new define USE_SPI_CRC for code cleanup when the CRC calculation is disabled.

The codegenerator generates (if CRC is disabled) in file stm32f4_hal_conf.h

&sharpdefine USE_SPI_CRC                     0U

And the library checks against:

&sharpifdef USE_SPI_CRC

The problem is that even the USE_SPI_CRC is defined to ZERO, it IS DEFINED.

So that the preprocessor ALWAYS handle

&sharpifdef USE_SPI_CRC

as defined.

I see here two solutions:

1) do not define USE_SPI_CRC at all in this case CRC is not used, i.e. comment out the line

2) for testing if the feature should be used rewrite the test to: &sharpif USE_SPI_CRC

I think the 2) is the more robust. (You should not &sharpundef )

1) AND 2) is I thing more optimal.

For now I undef the generated code always after every generation :-(

regards, Adib.

#!stm32-!cubemx-!spi-!bug #-
4 REPLIES 4
taraben
Senior
Posted on February 14, 2016 at 17:30

I meant I modify stm32f4xx_hal_conf.h like this

// #define USE_SPI_CRC                     0U

Adib.

Amel NASRI
ST Employee
Posted on February 29, 2016 at 16:57

Hi adib,

Thanks for keeping our attention to this bug.

It is reported internally and you will be updated we have details on the planning to fix it.

Sorry for the inconvenience this may bring for you.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

l-proger
Associate II
Posted on March 02, 2016 at 13:33

Undef after every generation is error-prone. You can find more bugs and fixing all of them every regeneration is really wrong.

I'm fixing bugs right inside code 'repository' on my PC. For example SPI CRC problem:

1. Open file ''C:\Users\%USERNAME%\STM32Cube\Repository\STM32Cube_FW_F4_V1.11.0\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.c''

2. Find line #include ''stm32f4xx_hal.h''

3. After that line add code: #undef USE_SPI_CRC

4. Now regenerate code and forget about bug

stm32cube-t
Senior III
Posted on April 12, 2016 at 14:29

USE_SPI_CRC define issue will be resolved with STM32CubeMX 4.15.