This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LC4357: Generating interrupt for motor control

Part Number: TMS570LC4357

Hi, I require some help with regards to generating an interrupt service routine for motor control purposes.

Currently, I have an embedded system which has tasks scheduled on a switch case. Each task is scheduled to run for 1 millisecond and there are a total of 10 tasks, giving a total of 10 milliseconds.

These tasks include:

  • Computing motor speed from encoder values
  • Checking for obstacle
  • Checking for CAN communication
  • Supervisory logic to change states, target speed
  • Motor control- PID controller to determine output PWM
  • (and other functionalities)

However, as this motor control function is only run every 10ms, the output PWM is only updated every 10 ms, resulting in undesirable control performance as the actual speed profile is unable to track the desired speed profile closely.

In order to improve the motor control, I would like to know if it is possible to generate an interrupt service routine that is able to run a PID control function at a frequency higher than 10ms (e.g. at a frequency of 1 kHz or 10 kHz) instead of inside the task scheduler, without affecting the performance of the other 10ms tasks.