TI中文支持网
TI专业的中文技术问题搜集分享网站

TMS320F28377DPTP使用PWM11、PWM12的问题

TMS320F28377DPTP使用PWM1、2、3都没问题,使用PWM11、12时失败。怀疑是IO的复用配置错误,

1、例程对PWM11的IO配置错误,手册上PWM11A PWM11B对应的IO是GPIO20/21。

void InitEPwm11Gpio(void)
{
EALLOW;
/* Disable internal pull-up for the selected output pins
for reduced power consumption */
// Pull-ups can be enabled or disabled by the user.
// This will enable the pullups for the specified pins.
// Comment out other unwanted lines.

GpioCtrlRegs.GPFPUD.bit.GPIO165 = 1; // Disable pull-up on GPIO165 (EPWM11A)
GpioCtrlRegs.GPFPUD.bit.GPIO166 = 1; // Disable pull-up on GPIO166 (EPWM11B)

/* Configure EPWM-6 pins using GPIO regs*/
// This specifies which of the possible GPIO pins will be EPWM6 functional pins.
// Comment out other unwanted lines.

GpioCtrlRegs.GPFMUX1.bit.GPIO165 = 1; // Configure GPIO165 as EPWM11A
GpioCtrlRegs.GPFMUX1.bit.GPIO166 = 1; // Configure GPIO166 as EPWM11B

EDIS;
}

2、例程对PWM12的IO配置错误,GpioCtrlRegs.GPAMUX2.bit.GPIO22 只有两位,根本配置不到4。

void InitEPwm12Gpio(void)
{
EALLOW;

GpioCtrlRegs.GPAPUD.bit.GPIO22 = 1 ; // Disable pull-up on GPIO22 (EPWM12A)
GpioCtrlRegs.GPAPUD.bit.GPIO23 = 1 ; // Disable pull-up on GPIO23 (EPWM12B)

GpioCtrlRegs.GPAMUX2.bit.GPIO22 = 4 ; // Configure GPIO22 as EPWM12A
GpioCtrlRegs.GPAMUX2.bit.GPIO23 = 4 ; // Configure GPIO23 as EPWM12B

EDIS;
}

例程与手册不符,头文件也不对。求救。

tang tang3:

能提供PWM11 PWM12的使用例程么?谢谢!

TMS320F28377DPTP使用PWM1、2、3都没问题,使用PWM11、12时失败。怀疑是IO的复用配置错误,

1、例程对PWM11的IO配置错误,手册上PWM11A PWM11B对应的IO是GPIO20/21。

void InitEPwm11Gpio(void)
{
EALLOW;
/* Disable internal pull-up for the selected output pins
for reduced power consumption */
// Pull-ups can be enabled or disabled by the user.
// This will enable the pullups for the specified pins.
// Comment out other unwanted lines.

GpioCtrlRegs.GPFPUD.bit.GPIO165 = 1; // Disable pull-up on GPIO165 (EPWM11A)
GpioCtrlRegs.GPFPUD.bit.GPIO166 = 1; // Disable pull-up on GPIO166 (EPWM11B)

/* Configure EPWM-6 pins using GPIO regs*/
// This specifies which of the possible GPIO pins will be EPWM6 functional pins.
// Comment out other unwanted lines.

GpioCtrlRegs.GPFMUX1.bit.GPIO165 = 1; // Configure GPIO165 as EPWM11A
GpioCtrlRegs.GPFMUX1.bit.GPIO166 = 1; // Configure GPIO166 as EPWM11B

EDIS;
}

2、例程对PWM12的IO配置错误,GpioCtrlRegs.GPAMUX2.bit.GPIO22 只有两位,根本配置不到4。

void InitEPwm12Gpio(void)
{
EALLOW;

GpioCtrlRegs.GPAPUD.bit.GPIO22 = 1 ; // Disable pull-up on GPIO22 (EPWM12A)
GpioCtrlRegs.GPAPUD.bit.GPIO23 = 1 ; // Disable pull-up on GPIO23 (EPWM12B)

GpioCtrlRegs.GPAMUX2.bit.GPIO22 = 4 ; // Configure GPIO22 as EPWM12A
GpioCtrlRegs.GPAMUX2.bit.GPIO23 = 4 ; // Configure GPIO23 as EPWM12B

EDIS;
}

例程与手册不符,头文件也不对。求救。

Seven Han:

你好,例程你可以参考:C:\ti\controlSUITE\device_support\F2837xD\v160\F2837xD_examples_Dual\adc_epwm

手册p845:Table7-9. GPIO and Peripheral Muxing 有详细说明

http://www.ti.com.cn/cn/lit/ug/spruhm8f/spruhm8f.pdf

TMS320F28377DPTP使用PWM1、2、3都没问题,使用PWM11、12时失败。怀疑是IO的复用配置错误,

1、例程对PWM11的IO配置错误,手册上PWM11A PWM11B对应的IO是GPIO20/21。

void InitEPwm11Gpio(void)
{
EALLOW;
/* Disable internal pull-up for the selected output pins
for reduced power consumption */
// Pull-ups can be enabled or disabled by the user.
// This will enable the pullups for the specified pins.
// Comment out other unwanted lines.

GpioCtrlRegs.GPFPUD.bit.GPIO165 = 1; // Disable pull-up on GPIO165 (EPWM11A)
GpioCtrlRegs.GPFPUD.bit.GPIO166 = 1; // Disable pull-up on GPIO166 (EPWM11B)

/* Configure EPWM-6 pins using GPIO regs*/
// This specifies which of the possible GPIO pins will be EPWM6 functional pins.
// Comment out other unwanted lines.

GpioCtrlRegs.GPFMUX1.bit.GPIO165 = 1; // Configure GPIO165 as EPWM11A
GpioCtrlRegs.GPFMUX1.bit.GPIO166 = 1; // Configure GPIO166 as EPWM11B

EDIS;
}

2、例程对PWM12的IO配置错误,GpioCtrlRegs.GPAMUX2.bit.GPIO22 只有两位,根本配置不到4。

void InitEPwm12Gpio(void)
{
EALLOW;

GpioCtrlRegs.GPAPUD.bit.GPIO22 = 1 ; // Disable pull-up on GPIO22 (EPWM12A)
GpioCtrlRegs.GPAPUD.bit.GPIO23 = 1 ; // Disable pull-up on GPIO23 (EPWM12B)

GpioCtrlRegs.GPAMUX2.bit.GPIO22 = 4 ; // Configure GPIO22 as EPWM12A
GpioCtrlRegs.GPAMUX2.bit.GPIO23 = 4 ; // Configure GPIO23 as EPWM12B

EDIS;
}

例程与手册不符,头文件也不对。求救。

Eric Ma:

1. GPIO165,GPIO166是针对BGA封装的,所以你要改成GPIO20, GPIO21.

2. 配置成PWM,你看一下手册4.5节中的PIN MULTIPLEXING。

先配置GPyGMUXn.GPIO20  = 01.

然后配置GPyMUXn.GPIO20 = 01.

即可。

ERIC

TMS320F28377DPTP使用PWM1、2、3都没问题,使用PWM11、12时失败。怀疑是IO的复用配置错误,

1、例程对PWM11的IO配置错误,手册上PWM11A PWM11B对应的IO是GPIO20/21。

void InitEPwm11Gpio(void)
{
EALLOW;
/* Disable internal pull-up for the selected output pins
for reduced power consumption */
// Pull-ups can be enabled or disabled by the user.
// This will enable the pullups for the specified pins.
// Comment out other unwanted lines.

GpioCtrlRegs.GPFPUD.bit.GPIO165 = 1; // Disable pull-up on GPIO165 (EPWM11A)
GpioCtrlRegs.GPFPUD.bit.GPIO166 = 1; // Disable pull-up on GPIO166 (EPWM11B)

/* Configure EPWM-6 pins using GPIO regs*/
// This specifies which of the possible GPIO pins will be EPWM6 functional pins.
// Comment out other unwanted lines.

GpioCtrlRegs.GPFMUX1.bit.GPIO165 = 1; // Configure GPIO165 as EPWM11A
GpioCtrlRegs.GPFMUX1.bit.GPIO166 = 1; // Configure GPIO166 as EPWM11B

EDIS;
}

2、例程对PWM12的IO配置错误,GpioCtrlRegs.GPAMUX2.bit.GPIO22 只有两位,根本配置不到4。

void InitEPwm12Gpio(void)
{
EALLOW;

GpioCtrlRegs.GPAPUD.bit.GPIO22 = 1 ; // Disable pull-up on GPIO22 (EPWM12A)
GpioCtrlRegs.GPAPUD.bit.GPIO23 = 1 ; // Disable pull-up on GPIO23 (EPWM12B)

GpioCtrlRegs.GPAMUX2.bit.GPIO22 = 4 ; // Configure GPIO22 as EPWM12A
GpioCtrlRegs.GPAMUX2.bit.GPIO23 = 4 ; // Configure GPIO23 as EPWM12B

EDIS;
}

例程与手册不符,头文件也不对。求救。

user4661451:

28377D这个IO口功能配置有两个地方需要配置,一个高位的,一个低位的。    GPyMUXn和GPyGMUXn     具体的值要配成什么样的,看datasheet就可以了。

赞(0)
未经允许不得转载:TI中文支持网 » TMS320F28377DPTP使用PWM11、PWM12的问题
分享到: 更多 (0)