主题中讨论的其他器件: SysConfig
您好!
我正在使用早期的 MSPM0L1306样片设计概念验证。 它使用4个 PWM 来驱动电机的绕组。 4个 PWM 的配置方式相同、只是一个 PWM 为控制律生成中断。
该工程使用 SysConfig 进行 MCU 配置。
当我运行代码时、没有来自其中一个 PWM 对(TIMG1)的信号。 所有其他 PWM 均按预期工作。
SysConfig 文件如下:
/**
* These arguments were used when this file was generated. They will be automatically applied on subsequent loads
* via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
* @cliArgs --device "MSPM0L130X" --package "VQFN-24(RGE)" --part "Default" --product "mspm0_sdk@0.57.00.00"
* @versions {"tool":"1.15.0+2826"}
*/
/**
* Import the modules used in this configuration.
*/
const Board = scripting.addModule("/ti/driverlib/Board");
const GPIO = scripting.addModule("/ti/driverlib/GPIO", {}, false);
const GPIO1 = GPIO.addInstance();
const PWM = scripting.addModule("/ti/driverlib/PWM", {}, false);
const PWM1 = PWM.addInstance();
const PWM2 = PWM.addInstance();
const PWM3 = PWM.addInstance();
const PWM4 = PWM.addInstance();
const SYSCTL = scripting.addModule("/ti/driverlib/SYSCTL");
const UART = scripting.addModule("/ti/driverlib/UART", {}, false);
const UART1 = UART.addInstance();
/**
* Write custom configuration values to the imported modules.
*/
Board.peripheral.$assign = "DEBUGSS";
Board.peripheral.swclkPin.$assign = "PA20";
Board.peripheral.swdioPin.$assign = "PA19";
GPIO1.$name = "SUPERVISION";
GPIO1.associatedPins.create(2);
GPIO1.associatedPins[0].$name = "OUT_ENABLE";
GPIO1.associatedPins[0].pin.$assign = "PA15";
GPIO1.associatedPins[1].direction = "INPUT";
GPIO1.associatedPins[1].$name = "NFAULT";
GPIO1.associatedPins[1].internalResistor = "PULL_UP";
PWM1.$name = "MOTA_PH1";
PWM1.timerCount = 781;
PWM1.timerStartTimer = true;
PWM1.interrupts = ["ZERO_EVENT"];
PWM1.peripheral.$assign = "TIMG1";
PWM1.peripheral.ccp0Pin.$assign = "PA0";
PWM1.peripheral.ccp1Pin.$assign = "PA1";
PWM1.PWM_CHANNEL_0.$name = "ti_driverlib_pwm_PWMTimerCC0";
PWM1.PWM_CHANNEL_0.ccValue = 780;
PWM1.PWM_CHANNEL_1.$name = "ti_driverlib_pwm_PWMTimerCC1";
PWM1.PWM_CHANNEL_1.ccValue = 780;
PWM2.$name = "MOTA_PH2";
PWM2.timerStartTimer = true;
PWM2.timerCount = 781;
PWM2.peripheral.ccp0Pin.$assign = "PA23";
PWM2.peripheral.ccp1Pin.$assign = "PA24/OPA0.IN0-";
PWM2.PWM_CHANNEL_0.$name = "ti_driverlib_pwm_PWMTimerCC2";
PWM2.PWM_CHANNEL_0.ccValue = 780;
PWM2.PWM_CHANNEL_1.$name = "ti_driverlib_pwm_PWMTimerCC3";
PWM2.PWM_CHANNEL_1.ccValue = 780;
PWM3.$name = "MOTB_PH1";
PWM3.timerStartTimer = true;
PWM3.timerCount = 781;
PWM3.peripheral.ccp0Pin.$assign = "PA3";
PWM3.peripheral.ccp1Pin.$assign = "PA4";
PWM3.PWM_CHANNEL_0.$name = "ti_driverlib_pwm_PWMTimerCC4";
PWM3.PWM_CHANNEL_0.ccValue = 780;
PWM3.PWM_CHANNEL_1.$name = "ti_driverlib_pwm_PWMTimerCC5";
PWM3.PWM_CHANNEL_1.ccValue = 780;
PWM4.$name = "MOTB_PH2";
PWM4.timerStartTimer = true;
PWM4.timerCount = 781;
PWM4.peripheral.ccp0Pin.$assign = "PA10";
PWM4.peripheral.ccp1Pin.$assign = "PA11";
PWM4.PWM_CHANNEL_0.$name = "ti_driverlib_pwm_PWMTimerCC6";
PWM4.PWM_CHANNEL_0.ccValue = 780;
PWM4.PWM_CHANNEL_1.$name = "ti_driverlib_pwm_PWMTimerCC7";
PWM4.PWM_CHANNEL_1.ccValue = 780;
SYSCTL.peripheral.$assign = "SYSCTL";
UART1.enabledInterrupts = ["RX"];
UART1.$name = "MyUART";
UART1.peripheral.rxPin.$assign = "PA22";
UART1.peripheral.txPin.$assign = "PA21";
/**
* Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
* version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
* re-solve from scratch.
*/
GPIO1.associatedPins[1].pin.$suggestSolution = "PA2";
PWM2.peripheral.$suggestSolution = "TIMG0";
PWM3.peripheral.$suggestSolution = "TIMG2";
PWM4.peripheral.$suggestSolution = "TIMG4";
UART1.peripheral.$suggestSolution = "UART0";
令人惊讶的是、最终引脚多路复用部分中不存在 TIMG1、这就解释了原因。 但是、这种方法的缺失很奇怪、在文本模式下编辑 SysConfig 字段来手动添加它并不能解决问题。
SysConfig 不会指示引脚属性有任何冲突、并且器件表示中突出显示的功能是正确的。
不知道为什么这个 PWM 没有输出?
提前感谢、
此致、
阿德里安