After counter decrease to 0:

1. SetPwm

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

TlgtMotDiagData[au8_Spindle].u16_ErrorId_OpenLoad == 0x04

ms_TlgmotData.Spindle[au8_Spindle].u16_TlgPWM = 0u;

 

2. SetPwmBsw

ae_PwmChannel [E_BSW_PW0_IH1]

lu16_DutyCycleStart [1E]= Sci_DRead_ParaSpindleMotor_u16_ActiveFreeWheelingDeadTime();
lu16_DutyCycle [C8]     = au16_Pwm;

(void)SCI_Call_Bsw_SetPwmSpindleMotor( ae_PwmChannel, lu16_DutyCycleStart, lu16_DutyCycleEnd);

 (E_BSW_PWO_IH1,0x1E,0xE6)

 

3. BSW

void BswIf_SetPwmDutyCyle(BswIf_SignalsT ae_SignalId, UNUM16 au16_DutyCycleStart, UNUM16 au16_DutyCycleEnd)

 (E_BSW_PWO_IH1,0x1E,0xE6)

lu8_PwmChannelId[0X00] = (UNUM8)BswIf_ms_SignalMapping[ae_SignalId].u16_BswSignal;

Pwm_SetPwmDutyCycle_OPWMB(lu8_PwmChannelId, au16_DutyCycleStart, au16_DutyCycleEnd);

(0,0x1E,0xE6)

Pwm_gs_PwmChannels[au8_PwmChannelId].u16_PwmChannelDutyCycleStart [0X0000] = au16_DutyCycleStart;
Pwm_gs_PwmChannels[au8_PwmChannelId].u16_PwmChannelDutyCycleEnd  [0X0000]= au16_DutyCycleEnd;

/* Get actual period of pwm channel */
    lu16_Period[0x01A5] = Emios_GetChannelB(0, Pwm_gs_PwmChannels[PWM_CLOCK_A_CH_23[0x06]].u8_PwmChannel);

/* Update the channel period and duty cycle */
    Pwm_UpdateDutyCyclePeriod_OPWMB(au8_PwmChannelId[0x00], lu16_Period[0x00]);

   if(au16_Period <= 0x01)
    {
        /* Only values greater than 0x1 are allowed to be written to B1 register (period register) */
        au16_Period[        ] = 0x02;
    }

 

/* Calculate the duty cycle . It is calculated in terms of counts of the pwm channel counter */
    /* This change is required to generate dutycycle from 1 to period instead of 0 to period. */
    lu16_DutyCycleStart[        ] = (( (au16_Period-1u) * Pwm_gs_PwmChannels[au8_PwmChannelId].u16_PwmChannelDutyCycleStart) / 1000u) + 1u;
    lu16_DutyCycleEnd [        ]  = (( (au16_Period-1u) * Pwm_gs_PwmChannels[au8_PwmChannelId].u16_PwmChannelDutyCycleEnd) / 1000u) + 1u;

    /* 3. Set the calculated duty cycle in the registers A and B */
    Emios_SetChannelA(0,Pwm_gs_PwmChannels[au8_PwmChannelId].u8_PwmChannel[0x04], lu16_DutyCycleStart[        ]);

1. After execute Emios_SetChannelA(), it ran into: Wdg_EarlyInit  of wdg.c 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄