cancel
Showing results for 
Search instead for 
Did you mean: 

stmcube mx and stm32f103rc rtc

Munyaradzi Gwena
Associate II
Posted on February 23, 2018 at 00:55

I am running version 4.24.0 of stm32cubeMX. I recently realized that when I try to generate any code the has rtc in it, the code generated in the rtc.c file is full of errors.

I have tried on both Mac OSX and Win 7
7 REPLIES 7
Posted on February 23, 2018 at 08:39

I would add some additional info:

-HAL or LL drivers?

-Target IDE  - Keil, Atollic...?

-maybe ioc project file to see what was enabled

Imen.D
ST Employee
Posted on February 26, 2018 at 13:10

Hello

Gwena.Munyaradzi

,

Could you please attach your ioc file to check your issue.

What exactly did the error message say?

Best Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Imen.D
ST Employee
Posted on February 26, 2018 at 13:54

Hi

Gwena.Munyaradzi

,

I want to thank you for your bug report and posting the details.

This issue is raised internally in CubeMx team and will be fixed in the next CubeMX release.

Sorry for any inconvenience it may cause.

Kind Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on February 26, 2018 at 12:57

 ,

 ,

I'm using HAL the target IDE is System Workbench for STM32

 ,

♯ MicroXplorer Configuration settings - do not modify

 ,

FREERTOS.IPParameters=Tasks01

 ,

FREERTOS.Tasks01=defaultTask,0,128,StartDefaultTask,Default,NULL

 ,

File.Version=6

 ,

KeepUserPlacement=false

 ,

Mcu.Family=STM32F1

 ,

Mcu.IP0=FREERTOS

 ,

Mcu.IP1=NVIC

 ,

Mcu.IP2=RCC

 ,

Mcu.IP3=RTC

 ,

Mcu.IP4=SYS

 ,

Mcu.IPNb=5

 ,

Mcu.Name=STM32F103R(C-D-E)Tx

 ,

Mcu.Package=LQFP64

 ,

Mcu.Pin0=PA13

 ,

Mcu.Pin1=VP_FREERTOS_VS_ENABLE

 ,

Mcu.Pin2=VP_RTC_VS_RTC_Activate

 ,

Mcu.Pin3=VP_RTC_VS_RTC_Calendar

 ,

Mcu.Pin4=VP_SYS_VS_ND

 ,

Mcu.Pin5=VP_SYS_VS_tim1

 ,

Mcu.PinsNb=6

 ,

Mcu.ThirdPartyNb=0

 ,

Mcu.UserConstants=

 ,

Mcu.UserName=STM32F103RCTx

 ,

MxCube.Version=4.24.0

 ,

MxDb.Version=DB.4.0.240

 ,

NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false

 ,

NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false

 ,

NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false

 ,

NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false

 ,

NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false

 ,

NVIC.PendSV_IRQn=true\:15\:0\:false\:false\:false\:true\:false

 ,

NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4

 ,

NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false

 ,

NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:true\:false

 ,

NVIC.TIM1_UP_IRQn=true\:0\:0\:false\:false\:true\:false\:false

 ,

NVIC.TimeBase=TIM1_UP_IRQn

 ,

NVIC.TimeBaseIP=TIM1

 ,

NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false

 ,

PA13.Locked=true

 ,

PA13.Signal=GPIO_Output

 ,

PCC.Checker=false

 ,

PCC.Line=STM32F103

 ,

PCC.MCU=STM32F103R(C-D-E)Tx

 ,

PCC.PartNumber=STM32F103RCTx

 ,

PCC.Seq0=0

 ,

PCC.Series=STM32F1

 ,

PCC.Temperature=25

 ,

PCC.Vdd=3.3

 ,

PinOutPanel.RotationAngle=0

 ,

ProjectManager.AskForMigrate=true

 ,

ProjectManager.BackupPrevious=false

 ,

ProjectManager.CompilerOptimize=2

 ,

ProjectManager.ComputerToolchain=false

 ,

ProjectManager.CoupleFile=true

 ,

ProjectManager.CustomerFirmwarePackage=C\:/Users/munya/.stm32cubemx/plugins/updater/STM32Cube_FW_F1_V1.6.0

 ,

ProjectManager.DefaultFWLocation=true

 ,

ProjectManager.DeletePrevious=true

 ,

ProjectManager.DeviceId=STM32F103RCTx

 ,

ProjectManager.FirmwarePackage=STM32Cube FW_F1 V1.6.0

 ,

ProjectManager.FreePins=false

 ,

ProjectManager.HalAssertFull=false

 ,

ProjectManager.HeapSize=0x200

 ,

ProjectManager.KeepUserCode=true

 ,

ProjectManager.LastFirmware=true

 ,

ProjectManager.LibraryCopy=1

 ,

ProjectManager.PreviousToolchain=SW4STM32

 ,

ProjectManager.ProjectBuild=false

 ,

ProjectManager.ProjectFileName=MK11_RTC.ioc

 ,

ProjectManager.ProjectName=MK11_RTC

 ,

ProjectManager.StackSize=0x400

 ,

ProjectManager.TargetToolchain=SW4STM32

 ,

ProjectManager.ToolChainLocation=

 ,

ProjectManager.UnderRoot=true

 ,

ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-true,3-MX_RTC_Init-RTC-false-HAL-true

 ,

RCC.APB1Freq_Value=8000000

 ,

RCC.APB2Freq_Value=8000000

 ,

RCC.FamilyName=M

 ,

RCC.IPParameters=APB1Freq_Value,APB2Freq_Value,FamilyName,PLLCLKFreq_Value,PLLMCOFreq_Value,TimSysFreq_Value

 ,

RCC.PLLCLKFreq_Value=8000000

 ,

RCC.PLLMCOFreq_Value=4000000

 ,

RCC.TimSysFreq_Value=8000000

 ,

VP_FREERTOS_VS_ENABLE.Mode=Enabled

 ,

VP_FREERTOS_VS_ENABLE.Signal=FREERTOS_VS_ENABLE

 ,

VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled

 ,

VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate

 ,

VP_RTC_VS_RTC_Calendar.Mode=RTC_Calendar

 ,

VP_RTC_VS_RTC_Calendar.Signal=RTC_VS_RTC_Calendar

 ,

VP_SYS_VS_ND.Mode=No_Debug

 ,

VP_SYS_VS_ND.Signal=SYS_VS_ND

 ,

VP_SYS_VS_tim1.Mode=TIM1

 ,

VP_SYS_VS_tim1.Signal=SYS_VS_tim1

 ,

board=MK11_RTC
Posted on February 26, 2018 at 13:31

Hi

DAHMEN.IMEN

Sorry I can't seem to be able to attach a file. I will have to send the the content of the ioc file.

#MicroXplorer Configuration settings - do not modify

FREERTOS.IPParameters=Tasks01

FREERTOS.Tasks01=defaultTask,0,128,StartDefaultTask,Default,NULL

File.Version=6

KeepUserPlacement=false

Mcu.Family=STM32F1

Mcu.IP0=FREERTOS

Mcu.IP1=NVIC

Mcu.IP2=RCC

Mcu.IP3=RTC

Mcu.IP4=SYS

Mcu.IPNb=5

Mcu.Name=STM32F103R(C-D-E)Tx

Mcu.Package=LQFP64

Mcu.Pin0=PA13

Mcu.Pin1=VP_FREERTOS_VS_ENABLE

Mcu.Pin2=VP_RTC_VS_RTC_Activate

Mcu.Pin3=VP_RTC_VS_RTC_Calendar

Mcu.Pin4=VP_SYS_VS_ND

Mcu.Pin5=VP_SYS_VS_tim1

Mcu.PinsNb=6

Mcu.ThirdPartyNb=0

Mcu.UserConstants=

Mcu.UserName=STM32F103RCTx

MxCube.Version=4.0

MxDb.Version=DB.4.0.240

NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false

NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false

NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false

NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false

NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false

NVIC.PendSV_IRQn=true\:15\:0\:false\:false\:false\:true\:false

NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4

NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false

NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:true\:false

NVIC.TIM1_UP_IRQn=true\:0\:0\:false\:false\:true\:false\:false

NVIC.TimeBase=TIM1_UP_IRQn

NVIC.TimeBaseIP=TIM1

NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false

PALocked=true

PASignal=GPIO_Output

PCC.Checker=false

PCC.Line=STM32F103

PCC.MCU=STM32F103R(C-D-E)Tx

PCC.PartNumber=STM32F103RCTx

PCC.Seq0=0

PCC.Series=STM32F1

PCC.Temperature=25

PCC.Vdd=3.3

PinOutPanel.RotationAngle=0

ProjectManager.AskForMigrate=true

ProjectManager.BackupPrevious=false

ProjectManager.CompilerOptimize=2

ProjectManager.ComputerToolchain=false

ProjectManager.CoupleFile=true

ProjectManager.CustomerFirmwarePackage=C\:/Users/munya/.stm32cubemx/plugins/updater/STM32Cube_FW_F1_V1.6.0

ProjectManager.DefaultFWLocation=true

ProjectManager.DeletePrevious=true

ProjectManager.DeviceId=STM32F103RCTx

ProjectManager.FirmwarePackage=STM32Cube FW_F1 V1.6.0

ProjectManager.FreePins=false

ProjectManager.HalAssertFull=false

ProjectManager.HeapSize=0x200

ProjectManager.KeepUserCode=true

ProjectManager.LastFirmware=true

ProjectManager.LibraryCopy=1

ProjectManager.PreviousToolchain=SW4STM32

ProjectManager.ProjectBuild=false

ProjectManager.ProjectFileName=MK11_RTC.ioc

ProjectManager.ProjectName=MK11_RTC

ProjectManager.StackSize=0x400

ProjectManager.TargetToolchain=SW4STM32

ProjectManager.ToolChainLocation=

ProjectManager.UnderRoot=true

ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-true,3-MX_RTC_Init-RTC-false-HAL-true

RCC.APB1Freq_Value=8000000

RCC.APB2Freq_Value=8000000

RCC.FamilyName=M

RCC.IPParameters=APB1Freq_Value,APB2Freq_Value,FamilyName,PLLCLKFreq_Value,PLLMCOFreq_Value,TimSysFreq_Value

RCC.PLLCLKFreq_Value=8000000

RCC.PLLMCOFreq_Value=4000000

RCC.TimSysFreq_Value=8000000

VP_FREERTOS_VS_ENABLE.Mode=Enabled

VP_FREERTOS_VS_ENABLE.Signal=FREERTOS_VS_ENABLE

VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled

VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate

VP_RTC_VS_RTC_Calendar.Mode=RTC_Calendar

VP_RTC_VS_RTC_Calendar.Signal=RTC_VS_RTC_Calendar

VP_SYS_VS_ND.Mode=No_Debug

VP_SYS_VS_ND.Signal=SYS_VS_ND

VP_SYS_VS_tim1.Mode=TIM1

VP_SYS_VS_tim1.Signal=SYS_VS_tim1

board=MK11_RTC

Posted on February 26, 2018 at 13:32

DAHMEN.IMEN

the Generated rtc.c file has this in it:

/* Includes ------------------------------------------------------------------*/

#include 'rtc.h'

#n

#n

/* USER CODE BEGIN 0 */

/* USER CODE END 0 */

RTC_HandleTypeDef hrtc;

#n

/* RTC init function */

void MX_RTC_Init(void)

{

#tRTC_TimeTypeDef sTime;

#tRTC_DateTypeDef DateToUpdate;

#n

#t#t/**Initialize RTC Only #n#t#t*/

#thrtc.Instance = RTC;

#tif(HAL_RTCEx_BKUPRead(&hrtc, RTC_BKP_DR1) != 0x32F2){

#thrtc.Init.AsynchPrediv = RTC_AUTO_1_SECOND;

#thrtc.Init.OutPut = RTC_OUTPUTSOURCE_ALARM;

#tif (HAL_RTC_Init(&hrtc) != HAL_OK)

#t{

#t#t_Error_Handler(__FILE__, __LINE__);

#t}

#n

#t#t/**Initialize RTC and set the Time and Date #n#t#t*/

#tsTime.Hours = 0x1;

#tsTime.Minutes = 0x0;

#tsTime.Seconds = 0x0;

#n

#tif (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD) != HAL_OK)

#t{

#t#t_Error_Handler(__FILE__, __LINE__);

#t}

#n

#tDateToUpdate.WeekDay = RTC_WEEKDAY_MONDAY;

#tDateToUpdate.Month = RTC_MONTH_JANUARY;

#tDateToUpdate.Date = 0x1;

#tDateToUpdate.Year = 0x0;

#n

#tif (HAL_RTC_SetDate(&hrtc, &DateToUpdate, RTC_FORMAT_BCD) != HAL_OK)

#t{

#t#t_Error_Handler(__FILE__, __LINE__);

#t}

#n

#t#tHAL_RTCEx_BKUPWrite(&hrtc,RTC_BKP_DR1,0x32F2);

#t}

#n}

#n

#n

#nvoid HAL_RTC_MspInit(RTC_HandleTypeDef* rtcHandle)

{#n

#tif(rtcHandle->Instance==RTC)

#t{

#t/* USER CODE BEGIN RTC_MspInit 0 */

#n#t/* USER CODE END RTC_MspInit 0 */

debuggg

Expression usedDriverFlag is undefined on line 730, column 75 in ip_c.ftl.

The problematic instruction:

----------

==> ${usedDriverFlag} [on line 730, column 73 in ip_c.ftl]

in user-directive generateServiceCode [on line 1234, column 5 in ip_c.ftl]

----------

Java backtrace for programmers:

----------

freemarker.core.InvalidReferenceException: Expression usedDriverFlag is undefined on line 730, column 75 in ip_c.ftl.

at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)

at freemarker.core.Expression.getStringValue(Expression.java:118)

at freemarker.core.Expression.getStringValue(Expression.java:93)

at freemarker.core.DollarVariable.accept(DollarVariable.java:76)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.IfBlock.accept(IfBlock.java:82)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.IfBlock.accept(IfBlock.java:82)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.Macro$Context.runMacro(Macro.java:164)

at freemarker.core.Environment.visit(Environment.java:601)

at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.IfBlock.accept(IfBlock.java:82)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167)

at freemarker.core.Environment.visit(Environment.java:415)

at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.Environment.visit(Environment.java:297)

at freemarker.core.CompressedBlock.accept(CompressedBlock.java:73)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167)

at freemarker.core.Environment.visit(Environment.java:415)

at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:208)

at freemarker.core.Environment.process(Environment.java:188)

at freemarker.template.Template.process(Template.java:237)

at com.st.microxplorer.codegenerator.CodeEngine.freemarkerDo(CodeEngine.java:264)

at com.st.microxplorer.codegenerator.CodeEngine.genCode(CodeEngine.java:185)

at com.st.microxplorer.codegenerator.CodeGenerator.generateOutputCode(CodeGenerator.java:2553)

at com.st.microxplorer.codegenerator.CodeGenerator.generatePeriphConfigCode(CodeGenerator.java:1483)

at com.st.microxplorer.codegenerator.CodeGenerator.generateCodeFiles(CodeGenerator.java:1175)

at com.st.microxplorer.codegenerator.CodeGenerator.generateCode(CodeGenerator.java:904)

at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.generateCode(ProjectBuilder.java:1038)

at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.createCode(ProjectBuilder.java:931)

at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.createProject(ProjectBuilder.java:461)

at com.st.microxplorer.plugins.projectmanager.engine.GenerateProjectThread.run(GenerateProjectThread.java:41)

Posted on March 13, 2018 at 14:38

Hello

Gwena.Munyaradzi

,

This issue is fixed in the new CubeMx release.

So, please download and update the new

http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-configurators-and-code-generators/stm32cubemx.html

to fix this issue.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen