TI E2E™ 设计支持论坛将于 5 月 30 日至 6 月 1 日进行维护。如果您在此期间需要技术支持,请联系 TI 的客户支持中心寻求帮助。

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.

[参考译文] MSP430FR2355:无法更改 PWM 频率

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1463859/msp430fr2355-cannot-change-pwm-freq

器件型号:MSP430FR2355

工具与软件:

我无法在 MSP430FR2355 EVM 套件上更改 PWM 占空比和周期。 我已经尝试了示例代码、我已经编写了自己的代码、并使用了我在网上找到的代码、但我仍然无法使它正常工作。 下面是我在 P1.1上输出32.7kHz PWM 信号的最新代码。 然而、更改 CCrO、CCR1和 CCR2值不会更改 frequnchey 的周期、在32.7kHz 时始终为50%。 MSPware 中的示例代码适用于 MSP430FR243x、虽然我已将其调整为适用于本例、但我仍然无法控制 PWM。

要求:

系统的方框图

最终、我需要40kHz PWM、因此我要设置 CCrO=24和 CCR1=12

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "intrinsics.h"
#include "msp430fr2355.h"
#include <driverlib.h>
#include <msp430.h>
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop WDT
// Configure P1.1 and P1.2 as Timer_B outputs
P1DIR |= BIT1 | BIT2; // P1.1 and P1.2 set as output
P1SEL1 |= BIT1 | BIT2; // P1.1 and P1.2 options select
// Disable GPIO high-impedance mode
PM5CTL0 &= ~LOCKLPM5;
TB0CCR0 = 1000 - 1; // PWM Period (e.g., 1 kHz with SMCLK at 1 MHz)
TB0CCTL1 = OUTMOD_7; // CCR1 reset/set
TB0CCR1 = 500; // CCR1 PWM duty cycle (50%)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


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

    您必须使用实际连接到计时器输出模块的引脚。 P1.6和 P1.7应起作用、但绝不能使用 P1.1和 P1.2。