Nucleo-H755 and confusion with timers
Hi,
I'm using the nucleo-h755xi for testing purposes and I'm doing configuration by using CubeMX.
I have opted to using the FreeRTOS middleware for both cores, CM7 will be using TIM6 and CM4 will be using TIM7 to generate ticks for the OS.
Now my question is, looking at the generated code and my settings over at CubeMX. The configuration looks as follows (I've underlined one result with red for future reference):
Now, in the reference manual it says:
This is how the Timer6 is supposed to look like.
The generated code for HAL_InitTick looks like this:
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
{
RCC_ClkInitTypeDef clkconfig;
uint32_t uwTimclock = 0;
uint32_t uwPrescalerValue = 0;
uint32_t pFLatency;
/*Configure the TIM6 IRQ priority */
HAL_NVIC_SetPriority(TIM6_DAC_IRQn, TickPriority ,0);
/* Enable the TIM6 global Interrupt */
HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn);
/* Enable TIM6 clock */
__HAL_RCC_TIM6_CLK_ENABLE();
/* Get clock configuration */
HAL_RCC_GetClockConfig(&clkconfig, &pFLatency);
/* Compute TIM6 clock */
uwTimclock = 2*HAL_RCC_GetPCLK1Freq();
/* Compute the prescaler value to have TIM6 counter clock equal to 1MHz */
uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000) - 1);
/* Initialize TIM6 */
htim6.Instance = TIM6;
/* Initialize TIMx peripheral as follow:
+ Period = [(TIM6CLK/1000) - 1]. to have a (1/1000) s time base.
+ Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock.
+ ClockDivision = 0
+ Counter direction = Up
*/
htim6.Init.Period = (1000000 / 1000) - 1;
htim6.Init.Prescaler = uwPrescalerValue;
htim6.Init.ClockDivision = 0;
htim6.Init.CounterMode = TIM_COUNTERMODE_UP;
if(HAL_TIM_Base_Init(&htim6) == HAL_OK)
{
/* Start the TIM time Base generation in interrupt mode */
return HAL_TIM_Base_Start_IT(&htim6);
}
/* Return function status */
return HAL_ERROR;
}I have stepped through the code with the debugger and obtained the following values:
line 21:
HAL_RCC_GetPCLK1Freq() == 64 000 000
uwTimclock == 128 000 000
First question:
Where does that 64 MHz come from? It is not in my configuration and I don't see dividers being able to accomplish this if you look at the CubeMX configuration.

Above is a screenshot (again) from the reference manual. And showing the default values which do not scale the sys_ck at all to get close to 64MHz.
Is this scaling to 64MHz done during HAL_init -function call? It seems to have some macros in it.
My second question is: What are the clock frequencies in CubeMX used for (for example the one I underlined)? As I though these would be used for the timer frequency.
What is the frequency of timers 16 and 17 in this instance (since I can't trust my own reasoning apparently)?
Are there any detailed resources that go over these configurations? It seems that for me, the manuals are too difficult to understand, all the changing notations and different pictures with no correlation from the previous one seem a bit too much.
Any help is appreciated, thanks!
Best regards,