1-Shunt Hall Sensored FOC (DRV8329A) - AM13E230X Peripheral Configuration
This page documents how the AM13E230X peripherals are configured by SysConfig
(1sh_hall_sen_foc_drv8329a.syscfg) for the LP-AM13E230X + DRV8329AEVM combination
with Hall sensor feedback.
The single-shunt Hall sensored topology uses two MCPWM instances: MCPWM4 generates
the three-phase motor PWM, while MCPWM0 (MTR1_SINGLE_SH_TRIG) acts as a dedicated
timing peripheral that generates four precisely-timed ADC triggers per PWM cycle to
reconstruct the three-phase currents from a single DC-link shunt measurement.
The Hall sensor interface is identical to the three-shunt Hall solution: three GPIO inputs (Hall A, Hall B, Hall C) are routed through the InputXBAR to ECAP1 for speed measurement. The FOC angle is derived from the Hall sector lookup table.
External Connections (Boosterpack Connector)
The table below maps motor-control signals to AM13E230X LaunchPad header pins for the LP-AM13E230X + DRV8329AEVM combination.
Signal |
LaunchPad Pin |
Description |
|---|---|---|
PWM_AH |
PB3 |
Phase A high-side PWM |
PWM_AL |
PA7 |
Phase A low-side PWM |
PWM_BH |
PB1 |
Phase B high-side PWM |
PWM_BL |
PA2 |
Phase B low-side PWM |
PWM_CH |
PB2 |
Phase C high-side PWM |
PWM_CL |
PA25 |
Phase C low-side PWM |
ADC_IDC |
PA30 |
DC-link current sense (single shunt) |
ADC_VDC |
PA17 |
DC bus voltage sense |
ADC_VU |
PA16 |
Phase U voltage sense |
ADC_VV |
PA18 |
Phase V voltage sense |
ADC_VW |
PA28 |
Phase W voltage sense |
nFAULT |
PA11 |
Gate driver fault input |
GATE_N_SLEEP |
PA3 |
Gate driver sleep/enable output |
DRV_OFF |
PB18 |
Gate driver OFF control |
IPD_OUT |
PA22 |
IPD async trip output |
DEBUG_TRIG |
PA20 |
Debug trigger output |
Hall A |
PB8 |
Hall sensor phase A input |
Hall B |
PB9 |
Hall sensor phase B input |
Hall C |
PA8 |
Hall sensor phase C input |
System-Level Signal Flow
The diagram below shows the complete signal routing from physical pins through the crossbar infrastructure to the PWM, ADC, CMPSS, ECAP, and Hall sensor peripherals.
1. MCPWM4 – Three-Phase PWM Generation
SysConfig instance: MTR1_MCPWM_BASE -> peripheral MCPWM4
Parameter |
Value |
Source |
|---|---|---|
Counter mode |
Up-Down (centre-aligned) |
|
PWM frequency |
10 kHz |
|
Dead-band RED |
20 TB cycles (100 ns) |
|
Dead-band FED |
10 TB cycles (50 ns) |
|
FED polarity |
Active-low (inverted) |
|
ADC SOC-A trigger |
Counter at ZERO |
|
SYNCOUT |
At TBCTR=ZERO -> feeds MCPWM0 |
|
Trip action |
Force A and B LOW |
|
One-shot trip sources |
OST1 (stop), OST2 (nFAULT), OST3 (OC) |
|
Emulation mode |
Free-run |
|
Note
Unlike the 3-shunt solution where PWM4_SOCA fires at TBCTR=U_CMPC (mid-cycle),
the 1-shunt solution fires PWM4_SOCA at TBCTR=ZERO. This triggers ADC0 for
voltage sensing only. The four DC-link current samples are triggered by MCPWM0
at precisely computed compare points around the active switching vectors.
PWM Pin Mapping – LaunchPad Header
PWM Output |
AM13E230X Pin |
DRV8329 Signal |
|---|---|---|
PWM4_1A (Phase A High) |
PB3 |
INHA |
PWM4_1B (Phase A Low) |
PA7 |
INLA |
PWM4_2A (Phase B High) |
PB1 |
INHB |
PWM4_2B (Phase B Low) |
PA2 |
INLB |
PWM4_3A (Phase C High) |
PB2 |
INHC |
PWM4_3B (Phase C Low) |
PA25 |
INLC |
2. MCPWM0 – Single-Shunt ADC Trigger Timer
SysConfig instance: MTR1_SINGLE_SH_TRIG -> peripheral MCPWM0
This is the key differentiator of the single-shunt topology. MCPWM0 has no PWM output
pins – it operates purely as a timing peripheral. It is synchronised from
MCPWM4_SYNCOUT (at TBCTR=ZERO) and generates four ADC start-of-conversion triggers
at compare points computed by the FOC algorithm to sample the DC-link current during
the two active switching vectors of each PWM half-cycle.
Parameter |
Value |
Description |
|---|---|---|
Counter mode |
Up-Down (centre-aligned) |
Matches MCPWM4 |
Period |
Same as MCPWM4 (10000) |
Synchronised operation |
Sync source |
|
Phase-locked to motor PWM |
SOCA trigger |
Counter up, CMP1A ( |
DC-link current sample 1 |
SOCB trigger |
Counter up, CMP2A ( |
DC-link current sample 2 |
SOCC trigger |
Counter down, CMPC ( |
DC-link current sample 3 |
SOCD trigger |
Counter down, CMPD ( |
DC-link current sample 4 + VW + VV |
Output pins |
None |
Timing only, no GPIO routing |
Global load |
Enabled |
Compare values updated each PWM cycle |
The four compare values (U_CMP1A, U_CMP2A, D_CMPC, D_CMPD) are updated each
PWM cycle by the FOC algorithm based on the current duty cycle to ensure sampling
occurs during the active vector intervals when the DC-link current equals a phase current.
3. ADC – DC-Link Current Reconstruction and Voltage Sensing
The single-shunt topology requires four DC-link current samples per PWM cycle to
reconstruct all three phase currents. All four samples are taken on ADC2 from the
same pin (PA30), triggered by the four MCPWM0 SOC outputs.
Signal Name |
ADC Instance |
SOC |
AM13E230X Pin |
AIN Channel |
Trigger |
Measurement |
|---|---|---|---|---|---|---|
|
ADC0 |
SOC0 |
PA17 |
AIN17 |
PWM4_SOCA (ZERO) |
DC bus voltage |
|
ADC0 |
SOC1 |
PA16 |
AIN16 |
PWM4_SOCA (ZERO) |
Phase U voltage |
|
ADC1 |
SOC0 |
PA18 |
AIN18 |
PWM0_SOCD |
Phase V voltage |
|
ADC2 |
SOC0 |
PA30 |
AIN32 |
PWM0_SOCA (U_CMP1A) |
DC-link current sample 1 |
|
ADC2 |
SOC1 |
PA30 |
AIN32 |
PWM0_SOCB (U_CMP2A) |
DC-link current sample 2 |
|
ADC2 |
SOC2 |
PA30 |
AIN32 |
PWM0_SOCC (D_CMPC) |
DC-link current sample 3 |
|
ADC2 |
SOC3 |
PA30 |
AIN32 |
PWM0_SOCD (D_CMPD) |
DC-link current sample 4 |
|
ADC2 |
SOC4 |
PA28 |
AIN30 |
PWM0_SOCD |
Phase W voltage |
ADC interrupt: ADC0_INT1 fires after ADC0_SOC1 (MTR1_VU_SEN) conversion
completes and drives the FOC ISR (motor1CtrlISR). This ensures all voltage
measurements are complete before the ISR executes.
Current reconstruction: The FOC algorithm selects two of the four DC-link current samples (based on the active switching sector) to reconstruct the three phase currents. The four samples provide redundancy and allow reconstruction in all six sectors.
4. CMPSS2 – Hardware Overcurrent Protection
SysConfig instance: MTR1_CMPSS_IDC -> peripheral CMPSS2
A single CMPSS-Lite instance monitors the DC-link current on PA30. The DAC threshold
is set to 1800 counts (approximately 1.46 V on a 3.3 V reference), corresponding
to the maximum allowable DC-link current.
Parameter |
Value |
Description |
|---|---|---|
CMPSS instance |
CMPSS2 |
|
P-input pin |
PA30 |
DC-link current sense |
N-input |
Internal DAC-H |
Programmable threshold |
DAC-H value |
1800 counts |
Approximately 1.46 V overcurrent threshold |
DAC-L value |
1000 counts |
Enabled as analog output on PA4 |
CTRIPH invert |
No invert |
Active-high trip (differs from 3-shunt) |
Filter window |
8 samples, prescale=1 |
Digital debounce |
Filtered path |
|
PWM one-shot trip |
Async path |
|
IPD pulse output |
DAC-L output |
|
Current monitor / debug |
Note
Unlike the 3-shunt solution which inverts CTRIPH inside the CMPSS block, the
1-shunt solution uses no inversion on CTRIPH – the inversion is applied in
PWMXBAR3 instead.
5. Hall Sensor Interface
The Hall sensor interface is identical to the three-shunt Hall sensored solution. Three Hall sensor signals are read via GPIO inputs, routed through the InputXBAR to ECAP1 for speed measurement, and decoded by the FOC algorithm to determine rotor position.
Hall GPIO Inputs
SysConfig group: MTR1_HALL
Hall Signal |
GPIO Pin |
GPIO Number |
InputXBAR |
SysConfig Name |
Role |
|---|---|---|---|---|---|
Hall A |
PB8 |
GPIO40 |
InputXBAR4 (INPUT4) |
|
Sector decode + ECAP |
Hall B |
PB9 |
GPIO41 |
InputXBAR3 (INPUT3) |
|
Primary ECAP1 input |
Hall C |
PA8 |
GPIO8 |
InputXBAR5 (INPUT5) |
|
Sector decode + ECAP |
Hall Speed Measurement (ECAP1)
SysConfig instance: HALL_SPEED_CAP -> ECAP1
Parameter |
Value |
|---|---|
Input source |
|
Capture mode |
Capture (not APWM) |
Emulation mode |
Free-run |
Counter reset |
On Event 1 (each captured edge resets the counter) |
Speed calculation |
Period between consecutive Hall edges -> |
ECAP1 captures the time between consecutive Hall sensor edges. The counter is reset on each captured event, so the captured value directly represents the period of the Hall signal. The FOC algorithm converts this period to speed in Hz.
Direction-Dependent XBAR Switching
HAL_Hall_updateEcapInput_inline() dynamically switches the ECAP1 input between
Hall A, B, and C via the InputXBAR on each Hall state transition. The function selects
the InputXBAR channel corresponding to the next expected Hall edge for the current
motor direction, maximising speed measurement resolution at all speeds.
Hall Sector to Angle Mapping
The three Hall GPIO inputs form a 3-bit sector code (Hall C, Hall B, Hall A). The FOC
algorithm decodes this code using a lookup table to determine the electrical angle
sector (0 to 5, each spanning 60 degrees). The sector midpoint angle is used as
angleHall_rad and written to angleFOC_rad for the current controller.
Hall State (C,B,A) |
Sector |
Electrical Angle (approx.) |
|---|---|---|
0b001 (A=1,B=0,C=0) |
0 |
30 deg |
0b011 (A=1,B=1,C=0) |
1 |
90 deg |
0b010 (A=0,B=1,C=0) |
2 |
150 deg |
0b110 (A=0,B=1,C=1) |
3 |
210 deg |
0b100 (A=0,B=0,C=1) |
4 |
270 deg |
0b101 (A=1,B=0,C=1) |
5 |
330 deg |
Note
The exact angle offsets depend on the physical Hall sensor placement relative to the motor poles. If the motor runs in the wrong direction or exhibits poor torque, adjust the Hall sensor wiring order (swap any two Hall wires) or update the sector-to-angle offset in the Hall configuration.
6. Crossbar (INPUTXBAR / PWMXBAR / OUTPUTXBAR)
The crossbar infrastructure routes fault signals to the PWM trip zone, provides the IPD output and debug trigger signals, and routes Hall sensor signals to ECAP1.
Crossbar |
SysConfig Name |
Source |
Destination |
Purpose |
|---|---|---|---|---|
INPUTXBAR1 |
|
Tied LOW |
PWMXBAR1 -> TZ1 |
Software motor stop |
INPUTXBAR2 |
|
PA11 (nFAULT GPIO) |
PWMXBAR2 -> TZ2 |
Gate driver fault trip |
INPUTXBAR3 |
|
PB9 (Hall B, GPIO41) |
ECAP1 |
Hall B speed capture (primary) |
INPUTXBAR4 |
|
PB8 (Hall A, GPIO40) |
ECAP1 (switched) |
Hall A speed capture |
INPUTXBAR5 |
|
PA8 (Hall C, GPIO8) |
ECAP1 (switched) |
Hall C speed capture |
PWMXBAR3 |
|
CMPSS2 CTRIPH (inverted) |
TZ3 |
Hardware OC trip |
OUTPUTXBAR5 |
|
CMPSS2 CTRIPOUTH |
PA22 |
IPD pulse output |
OUTPUTXBAR3 |
|
ADC2_EVT1 |
PA20 |
ADC debug trigger output |
Note
The 1-shunt solution routes nFAULT from PA11 (not PB4 as in the 3-shunt
solution). OUTPUTXBAR5 drives PA22 for the IPD output (not PA11).
A new OUTPUTXBAR3 (Debug_Trigger) routes ADC2_EVT1 to PA20 for
oscilloscope debugging of the ADC trigger timing.
7. ECAP – IPD Capture and Hall Speed Capture
ECAP0 – IPD Pulse Capture
SysConfig instance: IPD_CAPTURE -> ECAP0
Parameter |
Value |
|---|---|
Input source |
|
Capture mode |
Capture (not APWM) |
Emulation mode |
Free-run |
Sync-out |
Disabled |
Reset counters |
Enabled |
Capture event |
|
ECAP1 – Hall Speed Capture
SysConfig instance: HALL_SPEED_CAP -> ECAP1
Parameter |
Value |
|---|---|
Input source |
|
Capture mode |
Capture (not APWM) |
Emulation mode |
Free-run |
Counter reset |
On Event 1 (each Hall edge resets counter) |
Speed output |
|
8. GPIO – Gate Driver Control
SysConfig group: MTR1_GATE_DRIVER
GPIO Name |
Pin |
Direction |
Initial State |
DRV8329 Signal |
|---|---|---|---|---|
|
PA3 |
Output |
HIGH (active) |
nSLEEP |
|
PA11 |
Input |
– |
nFAULT |
|
PB18 |
Output |
LOW |
OFF |
SysConfig group: MTR1_FOC_CTRL
GPIO Name |
Pin |
Direction |
Purpose |
|---|---|---|---|
|
PA21 |
Output |
Fault indicator output |
|
PA23 |
Output |
ISR timing measurement (toggle in ISR) |
SysConfig group: MTR1_HALL
GPIO Name |
Pin |
Direction |
Purpose |
|---|---|---|---|
|
PB8 |
Input |
Hall sensor phase A |
|
PB9 |
Input |
Hall sensor phase B |
|
PA8 |
Input |
Hall sensor phase C |
Note
The DRV8329 uses nSLEEP (active-low sleep) instead of the DRV8323’s ENABLE
pin. DRV_OFF is an additional control pin unique to the DRV8329 that disables
the gate driver outputs without entering sleep mode.
9. UART – Serial Data Plot
SysConfig instance: SERIAL_DATA_PLOT -> UC1
Parameter |
Value |
|---|---|
Baud rate |
9 200 000 bps (9.2 Mbaud) |
Oversampling |
8x |
FIFO |
Enabled, TX threshold = empty, RX threshold = not-empty |
TX pin |
PA0 |
RX pin |
PA1 |
RX interrupt |
Enabled (for TI Tune command reception) |
Digital glitch filter |
4 cycles |
Used for high-speed streaming of motor variables (currents, speed, angle) to MotorVision / TI Tune during development and tuning.
10. System Clock
Parameter |
Value |
|---|---|
VREF source |
Internal 3.3 V |
HFCLK |
Enabled (1-shunt uses default PLL, no explicit SYSPLL config) |
Resulting TB clock |
200 MHz (PWM time-base) |
Complete Pin Summary
AM13E230X Pin |
AIN / Function |
Signal Name |
Peripheral |
Role |
|---|---|---|---|---|
PA0 |
– |
UART TX |
UC1 |
Serial plot TX |
PA1 |
– |
UART RX |
UC1 |
Serial plot RX (TI Tune) |
PA2 |
– |
PWM4_2B |
MCPWM4 |
Phase B Low |
PA3 |
– |
GATE_N_SLEEP |
GPIO |
DRV8329 nSLEEP |
PA4 |
AIN10 |
CMPSS2_DACL_OUT |
CMPSS2 |
DAC analog monitor output |
PA7 |
– |
PWM4_1B |
MCPWM4 |
Phase A Low |
PA8 |
– |
Hall C / INPUTXBAR5 |
GPIO + XBAR |
Hall sensor C |
PA11 |
– |
nFAULT_GPIO / INPUTXBAR2 |
GPIO + XBAR |
DRV8329 nFAULT |
PA16 |
AIN16 |
MTR1_VU_SEN |
ADC0 SOC1 |
Phase U voltage |
PA17 |
AIN17 |
MTR1_VDC_SEN |
ADC0 SOC0 |
DC bus voltage |
PA18 |
AIN18 |
MTR1_VV_SEN |
ADC1 SOC0 |
Phase V voltage |
PA20 |
– |
Debug_Trigger |
OUTPUTXBAR3 |
ADC2 event debug output |
PA21 |
– |
FAULT_OUTPUT |
GPIO |
Fault indicator |
PA22 |
– |
IPD_OUT |
OUTPUTXBAR5 |
IPD async trip output |
PA23 |
– |
ISR_TIMING |
GPIO |
ISR timing toggle |
PA25 |
– |
PWM4_3B |
MCPWM4 |
Phase C Low |
PA28 |
AIN30 |
MTR1_VW_SEN |
ADC2 SOC4 |
Phase W voltage |
PA30 |
AIN32 |
MTR1_IDC_SEN / CMPSS2_P |
ADC2 SOC0-3 / CMPSS2 |
DC-link current (x4) + OC |
PB1 |
– |
PWM4_2A |
MCPWM4 |
Phase B High |
PB2 |
– |
PWM4_3A |
MCPWM4 |
Phase C High |
PB3 |
– |
PWM4_1A |
MCPWM4 |
Phase A High |
PB8 |
– |
Hall A / INPUTXBAR4 |
GPIO + XBAR |
Hall sensor A |
PB9 |
– |
Hall B / INPUTXBAR3 |
GPIO + XBAR |
Hall sensor B (ECAP1 primary) |
PB18 |
– |
DRV_OFF |
GPIO |
DRV8329 OFF control |