cancel
Showing results for 
Search instead for 
Did you mean: 

[BUG]STM32CubeMX STM32F1 FW. 1.6.0 LSI_VALUE undeclared

martonmiklos
Senior
Posted on August 08, 2017 at 10:23

I have just updated one of my projects to STM32F1 FW 1.6.0, and my code was not able to compiled anymore. IOC file attached.

Here is my clocking scheme:

0690X00000607xsQAA.png

As you can see the LSI oscillator is not used, so I assume this is why the LSI_VALUE is not generated to the stm32f1xx_hal_rcc.h file. However the LSI_VALUE constant is still used in the stm32f1xx_hal_rcc_ex.c:

 case RCC_PERIPHCLK_RTC: 
 {
 /* Get RCC BDCR configuration ------------------------------------------------------*/
 temp_reg = RCC->BDCR;
 /* Check if LSE is ready if RTC clock selection is LSE */
 if (((temp_reg & RCC_BDCR_RTCSEL) == RCC_RTCCLKSOURCE_LSE) && (HAL_IS_BIT_SET(temp_reg, RCC_BDCR_LSERDY)))
 {
 frequency = LSE_VALUE;
 }
 /* Check if LSI is ready if RTC clock selection is LSI */
 else if (((temp_reg & RCC_BDCR_RTCSEL) == RCC_RTCCLKSOURCE_LSI) && (HAL_IS_BIT_SET(RCC->CSR, RCC_CSR_LSIRDY)))
 {
 frequency = LSI_VALUE;
 }
 else if (((temp_reg & RCC_BDCR_RTCSEL) == RCC_RTCCLKSOURCE_HSE_DIV128) && (HAL_IS_BIT_SET(RCC->CR, RCC_CR_HSERDY)))
 {
 frequency = HSE_VALUE / 128U;
 }
 /* Clock not enabled for RTC*/
 else
 {
 frequency = 0U;
 }
 break;�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

#stm32f103 #cube-mx
1 ACCEPTED SOLUTION

Accepted Solutions
Sirma Siang
ST Employee
Posted on September 15, 2017 at 11:40

Hello

Marton.Miklos

,

I have tested under Ubuntu 5 LTS.

Using cube 4.1, I openned your ioc, and migrate it to that latest version.

Then I have generated the project and compile using Eclipse system workbench plugin.

F1 FMW version is 1.6.0.

Everything went well at my end (no compilation error).

You said that you are not able to compile anymore.

Could you please describe the symptoms and error you get ?

Thanks in advance

Kind regards

Sirma

View solution in original post

12 REPLIES 12
Khouloud GARSI
Lead II
Posted on August 08, 2017 at 17:39

Hi

Marton.Miklos

‌,

Using the ioc file you have shared, I'm not facing any compilation issue: The 'LSI_VALUE' is defined in file 'stm32f1xx_hal_conf.h'.

Are you using the STM32CubeMX Version 4.0?

Khouloud.

martonmiklos
Senior
Posted on August 08, 2017 at 17:47

Well I saw a reply here from

garsi.khouloud

, but I cannot see now.

To answer your question: yes I am using the 4.0 What I have forgotten to mention that I have generated code for the STM32 Workbench target. Please see my stm32f1xx_hal_conf.h attached, I cannot find the LSI_VALUE defined there.

Posted on August 08, 2017 at 18:22

Please see my reply below. Somehow I got the notification about this post before it appeared here...

Posted on August 08, 2017 at 22:31

Hi

Marton.Miklos

‌,

Even if the used IDE is the '

STM32 Workbench', I'm not able to reproduce the issue: No compilation errors and the '

LSI_VALUE' is correctly defined under the 'stm32f1xx_hal_conf.h' file.

I advise you to create your project using STM32CubeMX from scratch and see if the issue persists. I'm waiting for your feedback.

Khouloud.

Posted on August 09, 2017 at 18:32

My answer was under moderation. Before being approved, other users were not able to see it.

However, since you are the owner of this request, you have received a notification about it.

Khouloud.

David McClurg
Associate
Posted on August 10, 2017 at 23:31

I seem to recall that I had the same issue when moving an existing project up to FW 1.6.  Initially, it was because I got a copy of FW 1.6 before the CubeMX template files had been updated for it.  Several days later, CubeMX was updated with the new templates for this version.  I believe that I had to actually make a change to the clock configuration, generate code from CubeMX, then change it back and generate code again before the correct template files got applied to my project.

My memory on this is a bit hazy, but it may be worth a try for you.

Posted on August 15, 2017 at 10:41

Hello

garsi.khouloud

,

I have created a blank project for the same MCU, and it does not generate the LSI value constant.

I have forgotten to mention that I am running the CubeMX under Linux. I think it should not matter, but it seems to be.

0690X00000607tCQAQ.png

Posted on August 15, 2017 at 10:42

Hi David,

I have tried to change the clocking scheme for using the LSI osc, but it did not helped. However the constant did not even generated from a blank project too.

Posted on August 15, 2017 at 11:00

Hi

Marton.Miklos

‌,

Previously, I have tested your project (using your shared ioc) under Windows OS; and I was not able to reproduce the issue. Taking into consideration that you're running the CubeMX tool under Linux, our teams will further investigate. Thanks for adding this detail.

We will keep you posted about any further update and we apologize for any inconvenience this may have caused.

Have a nice day .

Khouloud.