Skip to main content
MRobe.1
Associate III
August 28, 2023
Question

CubeMX Sys Timebase Source does not generate htim3 or xxx_timebase_tim.c

  • August 28, 2023
  • 3 replies
  • 1335 views

Hi

I have found that I have to "mess with" the Sys -> Timebase setting to get Generate Code to create the file stmf4xx_hal_timebase_tim.c.  I have no other timers enabled, just the Sys -> Timebase setting which is set to TIM3.

When I say "mess with" I mean this:

  • Generate Code does not generate the htim3 code nor the _timebase_tim.c file when Sys -> Timebase is, first, set to TIM3
  • I need to switch between timebase timers and generate code repeatedly, probably with multiple CubeMX restarts and even a PC restart
  • Somehow, I do not know why, it eventually works but I get the C file with htim3 declared

Once it has worked I find that regenerating code works every time.  It is just that getting it to generate code correctly the first time is a problem.

It should work first time.  It does not.  I am generating code for MDK V5.

Regards

This topic has been closed for replies.

3 replies

ST Employee
August 28, 2023

Hello @MRobe.1

Could you please specify the exact steps that led you to this issue? 

I generated a project from scratch using STM32CubeMX and only enabled system wakeup and chose TIM3 as the timebase source, and I didn't need to change anything as stm32f4xx_hal_timebase_tim.c is generated. 

image.png

MRobe.1
MRobe.1Author
Associate III
August 28, 2023

Hi Sarra

I did not enable System Wakeup (I am, only, using TIM3 for RTX2).  Let me clean out the project and attach the IOC once confirming it repeats with me.
Regards

MRobe.1
MRobe.1Author
Associate III
August 28, 2023

Hi Sarra

I have tried to repeat and have failed!  Given it was a simple project (none of my code) and it was the generated code that was complaining about htim3 being missing I cannot see that I dreamt it!  I suspect there was a clash with another setting which I have since, unknowingly, resolved.  Anyway, thanks for quick response.  

Regards