0
\$\begingroup\$

I am trying to implement a hardware timer for STM32F and read the value from it. So far, this is my implementation:

static TIM_HandleTypeDef s_TimerInstance = {.Instance = TIM7};

void vConfigureTimerForRunTimeStats()
{
  __TIM7_CLK_ENABLE();;
  HAL_TIM_Base_Start(&s_TimerInstance);

  while (true)
  {
      __HAL_TIM_GET_COUNTER(&s_TimerInstance);
      delay(100);
  }
}

I am getting the following error:

Field '__HAL_TIM_GET_COUNTER(&s_TimerInstance)' could not be
resolved

Can anyone help me out on this?

\$\endgroup\$
  • \$\begingroup\$ Can you trace back where the field above is defined? \$\endgroup\$ – Long Pham Dec 13 '18 at 15:33
  • \$\begingroup\$ tracing back takes me to stm32f0xx_hal_tim.h header file, which is included in my include \$\endgroup\$ – Nilabhra Patra Dec 13 '18 at 15:35
  • 1
    \$\begingroup\$ When you ask about a particular function in a library, it would be very helpful if you provided a link to that library. \$\endgroup\$ – KingDuken Dec 13 '18 at 15:52
1
\$\begingroup\$
#define __HAL_TIM_GET_COUNTER(__HANDLE__) \
   ((__HANDLE__)->Instance->CNT)

Above is defined in stmf32f0xx_hal_tim.h, which is probably not enabled or included.
Fix that, or use TIM7->CNT.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.