STSPIN32G4 running very hot
I designed my own PCB largely based on the EVALSTSPIN32G4, mine being a four layer board with components on both sides for compactness.
I generated code using MC Workbench 5.Y.4 with hall sensors. I implemented my own absolute encoder via SPI, and added CAN Bus communication.
Everything seems to be working fine, except that the MCU seems to be running at 60 to 70 degrees Celsius, and the board will eventually stop working.
I am powering it with a 22.2V 6 cell LiPo battery, but I have also powered it wit ha proper power source.
Running firmware for motor control only, with motor idle, the board pulls 0.15A at 24V. With the motor running it pulls 0.3A. Adding the encoder or CAN Bus does not add any significant current draw.
The only caveat is that I am bypassing Boot0 on pin B8 by clearing nSWBOOT0 on flash, since I use that pin for one of the hall effect sensors.
Below is the current NVIC table. I am using an interrupt for the encoder over SPI, but I might change that to DMA if it helps.
So the hypothesis right now is that overheating is causing my troubles. But it could be anything really, with all sub-systems running together. Running a separate code with encoder over SPI and CAN Bus is very robust. If I uncomment this line out MX_MotorControl_Init(); things get very hot ;)
Do you have any suggestions where to start looking for the source of this issue? It will be highly appreciated.

