Timebase Source TIM1: wrong initialization in MX code
I selected TIM1 as Timebase Source of HAL libraries. I think the generated code from MX tool is wrong.
HAL_InitTick() is called two times: the first during HAL_Init(), the second during SystemClock_Config(). However the first time is called as HAL_InitTick(TICK_INT_PRIORITY), the second time is called as HAL_InitTick(uwTickPrio).
uwTickPrio is normally updated during HAL_InitTick() defined in _hal.c, when Systick is used as timebase source. When TIM1 is used, HAL_InitTick() defined in _hal_timebase_tim.c doesn't update the variable, that still have the init value, an invalid priority.
So the second time HAL_InitTick() is called, an assert is fired during HAL_NVIC_SetPriority().
void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
{
uint32_t prioritygroup = 0x00;
/* Check the parameters */
assert_param(IS_NVIC_SUB_PRIORITY(SubPriority));
assert_param(IS_NVIC_PREEMPTION_PRIORITY(PreemptPriority));
prioritygroup = NVIC_GetPriorityGrouping();
NVIC_SetPriority(IRQn, NVIC_EncodePriority(prioritygroup, PreemptPriority, SubPriority));
}