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.

[参考译文] CAPTIVATE-FR2633:在 P1.1中生成 PWM 信号

Guru**** 2587345 points
Other Parts Discussed in Thread: MSP430FR2633, MSP430FR2433, CAPTIVATE-FR2633

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1060264/captivate-fr2633-producing-a-pwm-signal-in-p1-1

器件型号:CAPTIVATE-FR2633
主题中讨论的其他器件:MSP430FR2633MSP430WAREMSP430FR2433CAPTIVATE-METAL

您好!  

我已经尝试在 CapTIvate 开发板中 MSP430FR2633的 P1.1中输出 PWM 信号、但很幸运。  

我已经删除了所有与 CapTIvate 相关的代码、并尝试简单地生成 PWM P1.1、但它似乎不起作用。  

我正在使用示例代码 msp430fr243x_ta0_16.c - msp430fr243x_ta0_16.c (TI.com) ,我可以在 P1.2中看到漂亮的输出,但 P1.1保持低电平。  

我会假定(根据它提供的示例)它应该正常工作、但我不确定 CapTIvate 开发板是否有一些特殊的东西阻止我看到 PWM 信号。  

我无法使用 P1.2、因为我计划稍后添加 I2C、而 P1.2用作 SDA。  

如果您对获得 P1.1中的输出有任何帮助、我们将不胜感激。  

第1页。 我看过这个论坛帖子  :CAPTIVATE-FR2633:生成 PWM 信号- MSP 低功耗微控制器论坛- MSP 低功耗微控制器- TI E2E 支持论坛 、但这没有回答我的问题、因为我已经可以看到 P1.2中的 PWM 输出了。  

PS2。 附加我正在使用的示例代码。  

/* --COPYRIGHT--,BSD_EX
* Copyright (c) 2014, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************
*
* MSP430 CODE EXAMPLE DISCLAIMER
*
* MSP430 code examples are self-contained low-level programs that typically
* demonstrate a single peripheral function or device feature in a highly
* concise manner. For this the code may rely on the device's power-on default
* register values and settings such as the clock configuration and care must
* be taken when combining code from several examples to avoid potential side
* effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
* for an API functional library-approach to peripheral configuration.
*
* --/COPYRIGHT--*/
//*******************************************************************************
// MSP430FR24xx Demo - Timer0_A3, PWM TA0.1-2, Up Mode, DCO SMCLK
//
// Description: This program generates two PWM outputs on P1.1,P1.2 using
// Timer0_A configured for up mode. The value in CCR0, 1000-1, defines the PWM
// period and the values in CCR1 and CCR2 the PWM duty cycles. Using ~1MHz
// SMCLK as TACLK, the timer period is ~1ms with a 75% duty cycle on P1.1
// and 25% on P1.2.
// ACLK = default REFO ~32768Hz, MCLK = SMCLK = default DCODIV ~1MHz
//
//
// MSP430FR2433
// ---------------
// /|\| |
// | | |
// --|RST |
// | |
// | P1.1/TA0.1|--> CCR1 - 75% PWM
// | P1.2/TA0.2|--> CCR2 - 25% PWM
//
//
// Wei Zhao
// Texas Instruments Inc.
// Jan 2014
// Built with IAR Embedded Workbench v6.20 & Code Composer Studio v6.0.1
//******************************************************************************
#include <msp430.h>

int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop WDT

P1DIR |= BIT1 | BIT2; // P1.1 and P1.2 output
P1SEL1 |= BIT1 | BIT2; // P1.1 and P1.2 options select

// Disable the GPIO power-on default high-impedance mode to activate
// previously configured port settings
PM5CTL0 &= ~LOCKLPM5;

TA0CCR0 = 1000-1; // PWM Period
TA0CCTL1 = OUTMOD_7; // CCR1 reset/set
TA0CCR1 = 750; // CCR1 PWM duty cycle
TA0CCTL2 = OUTMOD_7; // CCR2 reset/set
TA0CCR2 = 250; // CCR2 PWM duty cycle
TA0CTL = TASSEL__SMCLK | MC__UP | TACLR; // SMCLK, up mode, clear TAR

__bis_SR_register(LPM0_bits); // Enter LPM0
__no_operation(); // For debugger
}

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

    您好、Eduardo、

    我检查了硬件设计文件、找不到任何连接会阻止 PWM 输出。

    谢谢!

    此致

    Johnson

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

    这就是我的想法。然而、P1.1中的输出在整个会话期间保持低电平。 它看起来不喜欢配置或其他东西。  

    非常有趣、它在 P1.2中运行得非常完美。  

    下图中的通道0为 P1.1、通道1为 P1.2

    我仔细检查了配置、我想不出可能出错或缺失的东西。  

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

    您好、Eduardo、

    我使用 https://dev.ti.com/tirex/explore/node?node=ADOsAt1KObKKFILvEHoSbw__IOGqZri__LATEST 测试了 P1.1

    结果显示 PWM 输出正常:

    谢谢!

    此致

    Johnson

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

    您好、Johnson、谢谢!
    您是否使用 CapTIvate FR2633板?  
    明天我会尝试另一个板、可能是我目前的板出现了问题。  

    我将使用完全相同的代码。  

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

    您好、Eduardo、

    是的、我使用 CAPTIVATE-FR2633电路板:

    谢谢!

    此致

    Johnson

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

    很棒!  

    谢谢、我将尝试使用另一个板、我将告诉您。  

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

    还可以。。。 在不同的电路板上尝试过、发现了相同的行为。  

    我们发现、只有在您连接电容式金属板(具有触摸金属键的板)时、问题才会出现。 很明显、P1.1引脚连接到该板中的 GND。  

    如果没有该板、一切都可以正常工作、这很遗憾、因为我尝试根据按下的按键测试生成不同的 PWM 输出。  

    感谢 Johnson 的帮助!