在官方数据手册中是这样描述 “Do not write in the region from the CNTIN register through the PWMLOAD register when FTMEN = 0.”
而FTMEN 的复位值就是为0,所以非常疑惑。
而在官方的库函数文件中
void FTM_DeInit(FTM_Type *pFTM)
{
ASSERT((FTM0 == pFTM) || (FTM1 == pFTM) || (FTM2 == pFTM));
pFTM->SC = 0;
pFTM->MOD = 0;
pFTM->CNT = 0;
if(FTM2 == pFTM)
{
pFTM->MODE = 0x4; //此时FTMEN = 0 ,不应该往CNTIN里写值
pFTM->COMBINE = 0;
pFTM->CNTIN = 0;
pFTM->SYNC = 0;
pFTM->OUTINIT = 0;
pFTM->OUTMASK = 0;
pFTM->DEADTIME = 0;
pFTM->EXTTRIG = 0;
pFTM->POL = 0;
pFTM->FMS = 0;
pFTM->FILTER = 0;
pFTM->FLTCTRL = 0;
pFTM->FLTPOL = 0;
pFTM->CONF = 0;
pFTM->SYNCONF = 0;
pFTM->SWOCTRL = 0;
pFTM->PWMLOAD = 0;
}
}
|