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

CubeMX HAL_Tick missing

  • August 28, 2023
  • 1 reply
  • 3067 views

Hi

When I Generate Code i find that HAL_Tick code is not generated and I am required to manually add code to get any MX code to work (given many _Init functions rely on HAL_Tick).  I add the code, below, to a USER_CODE area but I don't see why I should have to.

Regards

 

uint32_t HAL_GetTick (void) {
 static uint32_t ticks = 0U;
 uint32_t i;
	
 if (osKernelGetState () == osKernelRunning) {
 return ((uint32_t)osKernelGetTickCount ());
 }
 
 /* If Kernel is not running wait approximately 1 ms then increment and return auxiliary tick counter value */
 for (i = (SystemCoreClock >> 14U); i > 0U; i--) { __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); }
	 
 return ++ticks; 
}

 

This topic has been closed for replies.
Best answer by FBL

Hello @MRobe.1 

I will check internally and get back to you. According to uploading ioc file, an internal request has been submitted to learn more about updates of this known issue and uploading trusted files in general. Thank you for your comprehension.

Regarding HAL_GetTick, I have regenerated code using your ioc file. stm32f4xx_hal.c is being called. Timebase functions are generated. You may need to check stm32f4xx_hal_timebase_tim.c in Src files.

 

1 reply

TDK
Super User
August 28, 2023

Attach the IOC file where it fails to generate. Probably there is a relevant checkbox that is unchecked.

"If you feel a post has answered your question, please click ""Accept as Solution""."
MRobe.1
MRobe.1Author
Associate III
August 28, 2023

Yeah, once I rename the file I will upload as ST media upload is giving me this error on their filetype IOC:

Correct the highlighted errors and try again.

The attachment's stcubegenerated.ioc content type (application/octet-stream) does not match its file extension and has been removed

AScha.3
Super User
August 28, 2023

pack it in a zip file, but not "zip" ! use .7z or .rar (zip is for silly reason not "allowed" !)

"If you feel a post has answered your question, please click ""Accept as Solution""."