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.

[参考译文] MSPM0L1306:PWM 未推出

Guru**** 2442090 points
Other Parts Discussed in Thread: MSPM0L1306, SYSCONFIG

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1237874/mspm0l1306-pwm-not-coming-out

器件型号:MSPM0L1306
主题中讨论的其他器件: 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 没有输出?

提前感谢、  

此致、

阿德里安

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Adrien:  

     

    您用于 TIMG1的引脚(PA0和 PA1)是开漏的。 这意味着它们在使用时需要一个上拉电阻器。 您是否使用了这样的引脚?

    如果没有、您能否测试一下这是否可以解决问题? 这是一篇 有关开漏引脚的文章。

    此外、您可以使用可以使用 TIMG1的不同引脚。 有关这方面的更多信息、请参阅 MSPM0L130x 混合信号微控制器数据表(引脚属性表)

     

    此致、

    迭戈·阿巴德

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Diego:

    非常感谢。 我们尚未能在这些引脚上添加上拉电阻器(QFN 难以使用)、但我已经能够在使用不同引脚组时测量 PWM。 在这个阶段、 这是我的问题最可能的解释。  

    非常感谢您的帮助、

    此致、

    阿德里安·瑟林