The TMS320F2812 is an older member of TI's C2000 family, but it was specifically designed around real-time control applications rather than general-purpose embedded processing.
Instead of using the F2812 to blink an LED or read a potentiometer, this project uses several of its peripherals together in a realistic motor-control application.
The basic idea is straightforward:
Measure motor speed β calculate speed error β execute PI control β update PWM duty cycle β measure current β repeat.
The motor is driven by a MOSFET connected to one of the F2812's PWM outputs. An incremental encoder provides feedback about the motor's rotational speed. A current-sense amplifier converts the motor current into a voltage that can be sampled by the F2812's 12-bit ADC.
A periodic control interrupt executes the speed-control algorithm. The measured speed is compared with the requested speed, and a PI controller adjusts the PWM duty cycle.
The F2812 is particularly suitable for this type of experiment because the device combines a C28x CPU with dedicated motor-control peripherals, ADC resources, Event Managers, QEP interfaces, timers, and communication interfaces.
The project also exposes the control variables through SCI/UART. This makes it possible to watch the requested speed, measured speed, PWM duty cycle, and motor current from a PC while the motor is running.
That makes the project useful for people interested in:
- Motor control
- Digital control loops
- C2000 DSPs
- PWM generation
- Encoder feedback
- ADC sampling
- PI controllers
- Power electronics
- Embedded control
- Legacy TI C2000 development
- Reusing older DSP hardware in laboratory equipment
The control system follows this sequence:
+----------------------+
| Speed Reference |
| 0 - 3000 RPM |
+----------+-----------+
|
v
+-------------+
| Speed Error |
+------+------+
|
v
+-------------+
| PI Control |
+------+------+
|
v
+-------------+
| PWM Output |
+------+------+
|
v
+----------------------+
| MOSFET Gate Driver |
+----------+-----------+
|
v
+-----------+
| DC Motor |
+-----+-----+
|
v
+-------------+
| Encoder |
+------+------+
|
v
+-------------+
| QEP |
+------+------+
|
+----------------+
|
v
Measured RPM
+----------------------+
| Speed Reference |
| 0 - 3000 RPM |
+----------+-----------+
|
v
+-------------+
| Speed Error |
+------+------+
|
v
+-------------+
| PI Control |
+------+------+
|
v
+-------------+
| PWM Output |
+------+------+
|
v
+----------------------+
| MOSFET Gate Driver |
+----------+-----------+
|
v
+-----------+
| DC Motor |
+-----+-----+
|
v
+-------------+
| Encoder |
+------+------+
|
v
+-------------+
| QEP |
+------+------+
|
+----------------+
|
v
Measured RPMA second feedback path measures motor current:
Motor Current
|
v
+------------+
| Shunt Res. |
+-----+------+
|
v
+-------------+
| Current Amp |
+------+------+
|
v
+--------------+
| F2812 ADC |
| ADC Channel |
+--------------+
Motor Current
|
v
+------------+
| Shunt Res. |
+-----+------+
|
v
+-------------+
| Current Amp |
+------+------+
|
v
+--------------+
| F2812 ADC |
| ADC Channel |
+--------------+This lets the project demonstrate both control feedback and analog measurement.
Suggested Hardware Test ProcedureStep 1 β Verify the controllerProgram a simple GPIO test and verify JTAG communication with the F2812.
Step 2 β Verify PWMConnect the selected PWM output to an oscilloscope.
Start with:
PWM frequency = 20 kHz
Duty cycle = 10 %
PWM frequency = 20 kHz
Duty cycle = 10 %Verify the waveform before connecting the motor power stage.
Step 3 β Verify ADCApply a known voltage to the selected ADC input and compare the measured ADC counts with the calculated voltage.
Step 4 β Verify encoderRotate the motor shaft manually and check that the encoder count changes correctly.
Step 5 β Run open-loopBefore enabling closed-loop control, run the motor at a fixed low PWM duty cycle.
For example:
10 %
20 %
30 %
40 %
10 %
20 %
30 %
40 %Check motor current and encoder feedback at each step.
Step 6 β Enable closed-loop controlStart with a relatively low speed reference:
500 RPM
500 RPMThen increase gradually:
1000 RPM
1500 RPM
2000 RPM
1000 RPM
1500 RPM
2000 RPMTune Kp and Ki while monitoring:
- Speed response
- Overshoot
- Settling time
- Motor current
- PWM duty cycle
- Encoder feedback




Comments