Hello ,
I recommend you firstly finding out the reason is software or hardware, so please do like this :
1) create a simple project ,then test it , if it can work well , the problem is your software.
2) it the simple project still make the board reboot , it maybe your board design reason , please check the circuit , maybe the watchdog , maybe some disturb made the mcu reset.
This need analysis your board circuit seriously .
Best Regards,
Alice
------------------------------------------------------------------------------------------
If this post answers your question, please click the Correct Answer button.
-----------------------------------------------------------------------------------
If this post help your question, please click the helpful Answer button.