2019-11-01 05:55 AM
Hi,
Am using STM32CubeIDE with FreeRTOS middleware (CMSISv1).
I dont see change in code generated in file stm32f4xx_hal_timebase_tim.c when I modify tick frequency to 100000 instead of the default 1000. In sys tab of configuration setting TIM8 as timebase source.
Below is the code in stm32f4xx_hal_timebase_tim.c :
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
{
RCC_ClkInitTypeDef clkconfig;
uint32_t uwTimclock = 0;
uint32_t uwPrescalerValue = 0;
uint32_t pFLatency;
/*Configure the TIM8 IRQ priority */
HAL_NVIC_SetPriority(TIM8_UP_TIM13_IRQn, TickPriority ,0);
/* Enable the TIM8 global Interrupt */
HAL_NVIC_EnableIRQ(TIM8_UP_TIM13_IRQn);
/* Enable TIM8 clock */
__HAL_RCC_TIM8_CLK_ENABLE();
/* Get clock configuration */
HAL_RCC_GetClockConfig(&clkconfig, &pFLatency);
/* Compute TIM8 clock */
uwTimclock = 2*HAL_RCC_GetPCLK2Freq();
/* Compute the prescaler value to have TIM8 counter clock equal to 1MHz */
uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000) - 1);
/* Initialize TIM8 */
htim8.Instance = TIM8;
htim8.Init.Period = (1000000 / 1000) - 1;
htim8.Init.Prescaler = uwPrescalerValue;
htim8.Init.ClockDivision = 0;
htim8.Init.CounterMode = TIM_COUNTERMODE_UP;
......
......
.....
}
Kindly confirm if my above understanding is correct ? Will this be done if I modify as below:
htim8.Init.Period = (1000000 - 1); // instead of ((1000000/1000) -1)
I have already set configTICK_RATE_HZ as 1000 in FreeRTOSConfig.h. What other modifications do I need to make?
Thank you.
2019-11-01 06:52 AM
Checked the output on tracelyzer, and see the change working with respect to ticks, but still scheduling is not appropriate, so I need to make some more modifications in generated code. Kindly guide me.