cancel
Showing results for 
Search instead for 
Did you mean: 

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

MRobe.1
Associate III

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

3 REPLIES 3
Sarra.S
ST Employee

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

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.

MRobe.1
Associate III

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
Associate III

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