dear
Use the 8714 internal watchdog, but there are some problems, the entire 8714 initialization code and feed the dog code as follows, 8714 initialization, 20ms Feed the dog once. MCU uses TI's mspm0g phenomenon is, in the non-debug mode, the drive motor is normal, but in the debug mode, the occasional generator stop, after checking for the watchdog problem, remove the watchdog enable, no matter what mode, all work normally, please help me to check if the current way of feeding the dog is correct. Thank you!
#define USE_8714_WD
static uint32_t wd_flash_tick = 0;
uint32_t DRV8714_Init(uint32_t reset)
{
uint32_t ret = 0;
Drv871x_SPI_Init();
if(reset)
{
DRV8714_SLEEP_INVALID();
delay_cycles(1000);
}
ret = DRV_SPI_CHK(drv_wr_reg(DREG_IC_CTRL1, 0xA7));
uint32_t cfg = 0x40;
#ifdef USE_8714_WD
cfg |= 0x0E;
#endif
ret |= DRV_SPI_CHK(drv_wr_reg(DREG_IC_CTRL2, cfg));
ret |= DRV_SPI_CHK(drv_wr_reg(DREG_PWM_CTRL2, 0x22));
ret |= DRV_SPI_CHK(drv_wr_reg(DREG_CSA_CTRL1, 0x00));
/* 设置过载电流 */
ret |= DRV_SPI_CHK(drv_wr_reg(DREG_VDS_CTRL1, 0x88));
ret |= DRV_SPI_CHK(drv_wr_reg(DREG_VDS_CTRL2, 0x88));
DRV8714_WD_flash();
return ret;
}
void DRV8714_WD_flash(void)
{
if(Get_DvTick(wd_flash_tick) >= 20)
{
wd_flash_tick = Get_SysTime();
uint32_t val = drv_rd_reg(DREG_IC_CTRL2);
val ^= 1;
drv_wr_reg(DREG_IC_CTRL2, val);
}
}