3-Shunt FOC (DRV8323RH) - AM13E230X Peripheral Configuration
This page documents how the AM13E230X peripherals are configured by SysConfig
(3sh_sen_less_foc_drv8323rh.syscfg) for the LP-AM13E230X + BOOSTXL-DRV8323RH combination.
The signal routing is captured in the generated .dot diagram
3sh_sen_less_foc_drv8323rh_am13e230x_lp_m33_nortos_ti_arm_clang.dot and the software
bindings are established in
drv8323_3sh_config.c.
External Connections (Boosterpack Connector)
The table below maps motor-control signals to AM13E230X LaunchPad header pins for the LP-AM13E230X + BOOSTXL-DRV8323RH 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_IU |
PA30 |
Phase U current sense (three-shunt) |
ADC_IV |
PA27 |
Phase V current sense (three-shunt) |
ADC_IW |
PA17 |
Phase W current sense (three-shunt) |
ADC_VDC |
PA26 |
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 |
PB4 |
Gate driver fault input |
GATE_EN |
PA3 |
Gate driver enable output |
GATE_MODE |
PB7 |
Gate driver mode select |
GATE_CAL |
PB11 |
Gate driver calibration |
GATE_GAIN |
PB12 |
Gate driver gain select |
IPD_OUT |
PA11 |
IPD async trip output |
System-Level Signal Flow
The diagram below shows the complete signal routing from physical pins through the crossbar infrastructure to the PWM, ADC, CMPSS, and ECAP peripherals.
1. MCPWM4 — Three-Phase PWM Generation
SysConfig instance: MTR1_MCPWM_BASE → peripheral MCPWM4
Software handle: halFOCConfig_M1.pwmCfg.pwmHandle = MTR1_MCPWM_BASE_BASE
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 up, CmpC |
|
Trip action |
Force A and B LOW |
|
One-shot trip sources |
OST1 (stop), OST2 (nFAULT), OST3 (OC) |
|
Emulation mode |
Free-run |
|
PWM Pin Mapping — LaunchPad Header
PWM Output |
AM13E230X Pin |
DRV8323RH 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. ADC — Current and Voltage Sensing
All three ADC instances are triggered synchronously by PWM4_SOCA (counter up, CmpC),
ensuring simultaneous sampling at the PWM centre point.
Signal Name |
ADC Instance |
SOC |
AM13E230X Pin |
AIN Channel |
Measurement |
|---|---|---|---|---|---|
|
ADC0 (ADC_0) |
SOC0 |
PA17 |
AIN17 |
Phase W current |
|
ADC0 (ADC_0) |
SOC1 |
PA16 |
AIN16 |
Phase U voltage |
|
ADC1 (ADC_1) |
SOC0 |
PA27 |
AIN29 |
Phase V current |
|
ADC1 (ADC_1) |
SOC1 |
PA18 |
AIN18 |
Phase V voltage |
|
ADC2 (ADC_2) |
SOC0 |
PA30 |
AIN32 |
Phase U current |
|
ADC2 (ADC_2) |
SOC1 |
PA28 |
AIN30 |
Phase W voltage |
|
ADC2 (ADC_2) |
SOC2 |
PA26 |
AIN28 |
DC bus voltage |
Software mapping in
drv8323_3sh_config.c:
/* Current sensing — adcCurrentCfg[] */
.adcCurrentCfg[0].adcResultBase = MTR1_IU_SEN_ADC_RESULT_BASE /* ADC2, SOC0 → PA30 */
.adcCurrentCfg[1].adcResultBase = MTR1_IV_SEN_ADC_RESULT_BASE /* ADC1, SOC0 → PA27 */
.adcCurrentCfg[2].adcResultBase = MTR1_IW_SEN_ADC_RESULT_BASE /* ADC0, SOC0 → PA17 */
/* Voltage sensing — adcVoltageCfg[] */
.adcVoltageCfg[3].adcResultBase = MTR1_VDC_SEN_ADC_RESULT_BASE /* ADC2, SOC2 → PA26 */
ADC0_INT1 fires after SOC0 conversion completes and drives the FOC ISR
(ADC0_INT1_IRQHandler / motor1CtrlISR). ADC1_PPB1 provides post-processing
offset compensation for Phase V current.
3. CMPSS — Hardware Overcurrent Protection
Three CMPSS-Lite instances provide per-phase hardware overcurrent trip with a programmable DAC threshold (initial value 1800 counts ≈ 1.46 V on a 3.3 V reference).
CMPSS Instance |
SysConfig Name |
Phase |
P-Input Pin |
DAC-H Value |
Filter Window |
Trip Path |
|---|---|---|---|---|---|---|
CMPSS2 |
|
U (IU) |
PA30 |
1800 counts |
8 samples, prescale=1 |
PWMXBAR3 → TZ3 (filtered) |
CMPSS1 |
|
V (IV) |
PA27 |
1800 counts |
8 samples, prescale=1 |
PWMXBAR3 → TZ3 (filtered) |
CMPSS0 |
|
W (IW) |
PA17 |
1800 counts |
8 samples, prescale=1 |
PWMXBAR3 → TZ3 (filtered) |
Two trip paths are generated per phase:
Filtered path (
CTRIPH→PWMXBAR3→TZ3): debounced by the digital filter (8-sample window), inverted, routed to PWM one-shot trip zone 3.Async path (
CTRIPOUTH→OUTPUTXBAR5→PA11): unfiltered async output used as the IPD (Initial Position Detection) capture input via ECAP0.
CMPSS2 DAC-L is additionally routed to PA4 as an analog output
(MTR1_CMPSS_U_BASE_DAC, lowDAC.enableDACOUT = true).
Software mapping:
.cmpCfg.cmpssHandle[0] = MTR1_CMPSS_U_BASE_BASE /* CMPSS2 — Phase U */
.cmpCfg.cmpssHandle[1] = MTR1_CMPSS_V_BASE_BASE /* CMPSS1 — Phase V */
.cmpCfg.cmpssHandle[2] = MTR1_CMPSS_W_BASE_BASE /* CMPSS0 — Phase W */
.cmpCfg.compType[0..2] = COMP_HIGH /* High comparator only */
4. Crossbar (INPUTXBAR / PWMXBAR / OUTPUTXBAR)
The crossbar infrastructure routes fault and protection signals to the PWM trip zone and to the ECAP capture input.
Crossbar |
SysConfig Name |
Source |
Destination |
Purpose |
|---|---|---|---|---|
INPUTXBAR1 |
|
Tied LOW |
PWMXBAR1 → TZ1 |
Software motor stop |
INPUTXBAR2 |
|
PB4 (nFAULT GPIO) |
PWMXBAR2 → TZ2 |
Gate driver fault trip |
PWMXBAR3 |
|
CMPSS0/1/2 CTRIPH (inverted) |
TZ3 |
Hardware OC trip |
OUTPUTXBAR5 |
|
CMPSS0/1/2 CTRIPOUTH |
ECAP0 + PA11 |
IPD pulse capture |
Software mapping:
.pwmCfg.MotorStoptripInputXBARSource = DL_XBAR_INPUT1 /* INPUTXBAR1 → TZ1 */
.pwmCfg.GateDriverFaultTZSource = DL_MCPWM_TZ_SIGNAL_OST2 /* TZ2 */
.pwmCfg.overCurrentTZSouce = DL_MCPWM_TZ_SIGNAL_OST3 /* TZ3 */
.pwmCfg.MotorStopTZSource = DL_MCPWM_TZ_SIGNAL_OST1 /* TZ1 */
5. ECAP0 — IPD Pulse Capture
SysConfig instance: IPD_CAPTURE → ECAP0
Software handle: halFOCConfig_M1.ecapIPDConfig.base = IPD_CAPTURE_BASE
Parameter |
Value |
|---|---|
Input source |
|
Capture mode |
Capture (not APWM) |
Emulation mode |
Free-run |
Sync-out |
Disabled |
Reset counters |
Enabled |
Capture event |
|
The ECAP captures the time between IPD current pulses to determine initial rotor position before starting the FOC algorithm.
6. GPIO — Gate Driver Control
SysConfig group: MTR1_GATE_DRIVER
GPIO Name |
Pin |
Direction |
Initial State |
DRV8323RH Signal |
|---|---|---|---|---|
|
PA3 |
Output |
HIGH (enabled) |
ENABLE |
|
PB4 |
Input |
— |
nFAULT |
|
PB7 |
Output |
LOW (pull-down) |
MODE |
|
PB12 |
Input |
— |
GAIN |
|
PB11 |
Output |
— |
CAL |
SysConfig group: MTR1_FOC_CTRL
GPIO Name |
Pin |
Direction |
Purpose |
|---|---|---|---|
|
PB6 |
Output |
Fault indicator output |
|
PA23 |
Output |
ISR timing measurement (toggle in ISR) |
Software mapping:
const HAL_DRV8323_Obj drv8323Inst_M1 = {
.gateEnableGPIO = MTR1_GATE_DRIVER_GATE_EN_GPIO_PORT_BASE, /* PA3 */
.gateEnableGPIONum = MTR1_GATE_DRIVER_GATE_EN_GPIO_PIN,
.gateCalGPIO = MTR1_GATE_DRIVER_GATE_CAL_GPIO_PORT_BASE, /* PB11 */
.gateCalGPIONum = MTR1_GATE_DRIVER_GATE_CAL_GPIO_PIN,
};
7. UART — Serial Data Plot
SysConfig instance: SERIAL_DATA_PLOT → UC1
Parameter |
Value |
|---|---|
Baud rate |
4 000 000 bps |
Direction |
TX only |
FIFO |
Enabled, RX threshold = FULL |
TX pin |
PA0 |
Used for high-speed streaming of motor variables (currents, speed, angle) to a serial plotter during development and tuning.
8. System Clock
Parameter |
Value |
|---|---|
VREF source |
Internal 3.3 V |
HFCLK |
Enabled |
SYSPLL reference |
HFCLK |
SYSPLL Q-divider |
32 |
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 |
PA2 |
— |
PWM4_2B |
MCPWM4 |
Phase B Low |
PA3 |
— |
GATE_EN |
GPIO |
DRV8323 ENABLE |
PA4 |
AIN10 |
CMPSS2_DACL_OUT |
CMPSS2 |
DAC analog output |
PA7 |
— |
PWM4_1B |
MCPWM4 |
Phase A Low |
PA11 |
— |
IPD_OUT |
OUTPUTXBAR5 |
IPD async trip output |
PA16 |
AIN16 |
MTR1_VU_SEN |
ADC0 SOC1 |
Phase U voltage |
PA17 |
AIN17 |
MTR1_IW_SEN / CMPSS0_P |
ADC0 SOC0 / CMPSS0 |
Phase W current + OC |
PA18 |
AIN18 |
MTR1_VV_SEN |
ADC1 SOC1 |
Phase V voltage |
PA23 |
— |
ISR_TIMING |
GPIO |
ISR timing toggle |
PA25 |
— |
PWM4_3B |
MCPWM4 |
Phase C Low |
PA26 |
AIN28 |
MTR1_VDC_SEN |
ADC2 SOC2 |
DC bus voltage |
PA27 |
AIN29 |
MTR1_IV_SEN / CMPSS1_P |
ADC1 SOC0 / CMPSS1 |
Phase V current + OC |
PA28 |
AIN30 |
MTR1_VW_SEN |
ADC2 SOC1 |
Phase W voltage |
PA30 |
AIN32 |
MTR1_IU_SEN / CMPSS2_P |
ADC2 SOC0 / CMPSS2 |
Phase U current + OC |
PB1 |
— |
PWM4_2A |
MCPWM4 |
Phase B High |
PB2 |
— |
PWM4_3A |
MCPWM4 |
Phase C High |
PB3 |
— |
PWM4_1A |
MCPWM4 |
Phase A High |
PB4 |
— |
nFAULT_GPIO / INPUTXBAR2 |
GPIO + XBAR |
DRV8323 nFAULT |
PB6 |
— |
FAULT_OUTPUT |
GPIO |
Fault indicator |
PB7 |
— |
GATE_MODE |
GPIO |
DRV8323 MODE |
PB11 |
— |
GATE_CAL |
GPIO |
DRV8323 CAL |
PB12 |
— |
GATE_GAIN |
GPIO |
DRV8323 GAIN |