cancel
Showing results for 
Search instead for 
Did you mean: 

Timebase no longer works after the TouchGFX Engine Initialization

ALomb.1
Associate III

Form TouchGFX Designer 4.18.1 I created a simple application.

I imported the project into the STM32CubeIDE (1.9) and added support for FreeRTOS.

I have selected TIM7 as the timebase source.

After calling TouchGFXGeneratedHAL::initialize() in file TouchGFXHAL.cpp the TIM7 interrupt is no longer called!

I also tried with other timers: same result.

What could be the problem ?

I noticed the problem because I had put a Hal_Delay after switching on the Display which never returned.

My hardware is NUCLEO-G071RE and X-NUCLEO-GFX01M1

17 REPLIES 17
MM..1
Chief III

Seems you dont setup interrupt priorities properly.

ALomb.1
Associate III

The timebase timer interrupt priority is set to 0 with "Uses FreeRTOS function" disabled.

Is not correct?

MM..1
Chief III

Show all interrupts config.

ALomb.1
Associate III

Interrupt configuration attached.

I also noticed that the HAL_InitTick function is called three times:

  • once from the HAL_Init with priority 0 (TICK_INT_PRIORITY);
  • twice from SystemClock_Config (HAL_RCC_OscConfig and HAL_RCC_ClockConfig) with priority 4 (uwTickPrio)

MM..1
Chief III

Break in debuger and check where code stuck, i mean in hard fault handler...

ALomb.1
Associate III

The code stuck in HAL_Delay called in MB1642BDisplayDriver_DisplayOn after TouchGFXGeneratedHAL::initialize().

If I remove the HAL_Delay the code correctly run.

If I add an HAL_Delay before TouchGFXGeneratedHAL::initialize() the code not stuck.

I can share the source code if it helps

MM..1
Chief III

Normal delay func is in hal weak , then maybe you try write own overide,

in F4 for example

__weak void HAL_Delay(uint32_t Delay)
{
  uint32_t tickstart = HAL_GetTick();
  uint32_t wait = Delay;
 
  /* Add a freq to guarantee minimum wait */
  if (wait < HAL_MAX_DELAY)
  {
    wait += (uint32_t)(uwTickFreq);
  }
 
  while((HAL_GetTick() - tickstart) < wait)
  {
  }
}
__weak void HAL_IncTick(void)
{
  uwTick += uwTickFreq;
}

ALomb.1
Associate III

Sorry @MM..1​, but I don't understand what you are telling me :smiling_face_with_smiling_eyes:

Do you think the interrupt configuration you asked me is correct ?

Do you think that the timebase interrupt priority at 4 (despite I have set 0 in the CubeMX) is correct ?

What I see is, despite the timebae configuration does not change (checked in debug), that its interrupt no longer fired after the call to the TouchGFX library function (TouchGFXGeneratedHAL::initialize())

As previously written if I remove this call the interrupt will fire correctly.

Unfortunately it's a library function and I can't debug it.

MM..1
Chief III

Sorry i reread your "simple" My hardware is NUCLEO-G071RE and X-NUCLEO-GFX01M1

This use custom settings (not simple) in TouchGFX and seems use too reconfig in touchGFX hal layer.

Check registers for enabled interrupts, config TIM7 and compare before and after (TouchGFXGeneratedHAL::initialize())

I dont understand Do you think that the timebase interrupt priority at 4, .... priority need be 0...