我想使用 PWM4 / PWM5 輸出脈波,2組設定都一樣,目前 PWM5 有脈波輸出,但是 PWM4 卻一直為HIGH, 請問該怎麼解決?我的設定如下~
void PWMA_CH45_Init(void)
{
CLK_EnableModuleClock(PWM45_MODULE);
CLK_SetModuleClock(PWM45_MODULE, CLK_CLKSEL2_PWM45_S_HIRC, 0);
SYS_ResetModule(PWM47_RST);
PllClock = FREQ_72MHZ; // PLL
SystemCoreClock = FREQ_72MHZ / 1; // HCLK
CyclesPerUs = FREQ_72MHZ / 1000000; // For SYS_SysTickDelay()
/* Set GPB multi-function pins for PWMB Channel1 and channel2 */
SYS->GPB_MFP = SYS_GPB_MFP_PB11_PWM4;
SYS->ALT_MFP = SYS_ALT_MFP_PB11_PWM4;
/* Set GPB multi-function pins for PWMB Channel1 and channel2 */
SYS->GPE_MFP = SYS_GPE_MFP_PE5_PWM5;
SYS->ALT_MFP = SYS_ALT_MFP_PE5_PWM5;
SYS->ALT_MFP2 = SYS_ALT_MFP2_PE5_PWM5;
}
void Run(void)
{
//PWM4 Seting
PWM_ConfigOutputChannel(PWMB, PWM_CH0, 1000, 50);
PWM_EnableOutput(PWMB, 0x1);
PWM_Start(PWMB, 0x1);
//PWM5 Seting
PWM_ConfigOutputChannel(PWMB, PWM_CH1, 1000, 50);
PWM_EnableOutput(PWMB, 0x2);
PWM_Start(PWMB, 0x2);
}
int main(void)
{
CLK_SetHCLK(CLK_CLKSEL0_HCLK_S_HIRC, CLK_CLKDIV_HCLK(1));
CLK_EnableXtalRC(CLK_PWRCON_OSC22M_EN_Msk);
CLK_WaitClockReady(CLK_CLKSTATUS_OSC22M_STB_Msk);
CLK_SetCoreClock(FREQ_72MHZ);
SystemCoreClockUpdate();
PWMA_CH45_Init();
Run();
while(1){};
} |