I was having the same problem, if you're reading this topic and have the same problem. I just get rid of it by modifying my original code with HAL_SuspendTick() function and it stops randomly waking up. Also clock source is selected as MSI 2.097Mhz, ...