Seems like a lot of Users are having similar issues of Ryzen 2xxx CPU/APUs crashing or freezing. If it continues, try installing a older version of AMD Driver and see if the problem is better or the same or worse.
You can use Search at AMD Forum to find out what threads may be applicable to your situation and see what type of fixes were done to try and fix the problems.