Hi,
I'm using the universal motor control lab with a 1ms trajectory generator for new reference positions. The problem that occurs now is, that the 1ms timer from the HAL_getCPUTimerStatus() is not synchronized with the
motor1CtrlISR(), and so they shift to each in time and around every 50s the interrupt interrupts the 1ms task and lead in position control mode to audiable noise.
Now, what I have tried is to trigger the 1ms task from the ISR itself, but then is a constant and random shift in time between the ISR and the 1ms task and in around 1% of the cases they intersect and lead to constant audiable noise. My question is, how can I make a synchronized 1ms task, that always has the same constant time shift to the ISR routine (the ISR should never interrupt the 1ms task, which takes around 10us and so they should have a constant phase shift to each other)?
Phaseshift is non-zero --> perfect:

Phaseshift is zero --> Noise:
