Fixed FreeRTOS tick rate.
This commit is contained in:
parent
3101adad33
commit
1f0887e8dc
|
@ -390,6 +390,17 @@ void _putchar(char character) {
|
|||
HAL_UART_Transmit(&huart1, (uint8_t *)&character, 1, 1000);
|
||||
}
|
||||
|
||||
static void update_frequency_profile(user_pm_vfs_preset_t profile) {
|
||||
taskENTER_CRITICAL();
|
||||
|
||||
user_pm_scale_vfs(profile);
|
||||
SysTick_Config(configCPU_CLOCK_HZ / configTICK_RATE_HZ);
|
||||
|
||||
HAL_UART_Init(&huart1);
|
||||
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
|
||||
/* USER CODE END 4 */
|
||||
|
||||
/* USER CODE BEGIN Header_StartDefaultTask */
|
||||
|
@ -402,28 +413,20 @@ void _putchar(char character) {
|
|||
void StartDefaultTask(void *argument)
|
||||
{
|
||||
/* USER CODE BEGIN 5 */
|
||||
|
||||
HeapStats_t stats;
|
||||
vPortGetHeapStats(&stats);
|
||||
printf("Heap available: %d bytes.\r\n", stats.xAvailableHeapSpaceInBytes);
|
||||
|
||||
/* Infinite loop */
|
||||
for(;;)
|
||||
{
|
||||
taskENTER_CRITICAL();
|
||||
user_pm_scale_vfs(USER_PM_VFS_HIGH_1);
|
||||
HAL_UART_Init(&huart1);
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
printf("Set frequency to 168MHz.\r\n");
|
||||
update_frequency_profile(USER_PM_VFS_HIGH_1);
|
||||
printf("[%012u] Set frequency to 168MHz.\r\n", xTaskGetTickCount());
|
||||
osDelay(10000);
|
||||
|
||||
vPortGetHeapStats(&stats);
|
||||
printf("Heap available: %d bytes.\r\n", stats.xAvailableHeapSpaceInBytes);
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
user_pm_scale_vfs(USER_PM_VFS_MID_1);
|
||||
HAL_UART_Init(&huart1);
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
printf("Set frequency to 84MHz.\r\n");
|
||||
|
||||
update_frequency_profile(USER_PM_VFS_MID_1);
|
||||
printf("[%012u] Set frequency to 84MHz.\r\n", xTaskGetTickCount());
|
||||
osDelay(10000);
|
||||
}
|
||||
/* USER CODE END 5 */
|
||||
|
|
|
@ -160,6 +160,9 @@ HAL_StatusTypeDef user_pm_scale_vfs(user_pm_vfs_preset_t preset) {
|
|||
user_pm_error_handler();
|
||||
}
|
||||
|
||||
// Update global variables
|
||||
SystemCoreClockUpdate();
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
|
|
2
Makefile
2
Makefile
|
@ -1,5 +1,5 @@
|
|||
##########################################################################################################################
|
||||
# File automatically-generated by tool: [projectgenerator] version: [3.14.1] date: [Tue Aug 24 04:58:49 CST 2021]
|
||||
# File automatically-generated by tool: [projectgenerator] version: [3.14.1] date: [Tue Aug 24 17:01:59 CST 2021]
|
||||
##########################################################################################################################
|
||||
|
||||
# ------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue